Move to Cell Excel VBA
Move to Cell Excel VBA is a code sample which demonstrates how to move to a specific cell that you determine.
The code that finds and selects the cell is near the bottom. The code before it is code used to supply sample data.
Sub MoveToCellExcelVBA() Dim MaxVal As Integer Dim theRow As Integer Dim theCol As Integer Range("A1").Select ActiveCell.FormulaR1C1 = "1" Range("B1").Select ActiveCell.FormulaR1C1 = "2" Range("A1:B1").Select Selection.AutoFill Destination:=Range("A1:H1"), Type:=xlFillDefault Range("A1:H1").Select Range("A2").Select ActiveCell.FormulaR1C1 = "3" Range("A1:A2").Select Selection.AutoFill Destination:=Range("A1:A20"), Type:=xlFillDefault Range("A1:A20").Select Range("B2").Select ActiveCell.FormulaR1C1 = "=R1C*RC1" Range("B2").Select Selection.AutoFill Destination:=Range("B2:H2"), Type:=xlFillDefault Range("B2:H2").Select Selection.AutoFill Destination:=Range("B2:H20"), Type:=xlFillDefault Range("B2:H20").Select Range("E11").Select ActiveCell.FormulaR1C1 = "1000" Range("A1").Select ' The code from here finds and selects the cell Range("A1:H20").Select MaxVal = -32768 ActiveCell.SpecialCells(xlLastCell).Select For intRow = 1 To ActiveCell.Row For intCol = 1 To ActiveCell.Column If Cells(intRow, intCol).Value > MaxVal Then MaxVal = Cells(intRow, intCol).Value theRow = intRow theCol = intCol End If Next Next Cells(theRow, theCol).Select End Sub
This
site is powered by Site Build It!. If you enjoy it, please check out
the Site
Build It homepage to learn more and on how to build
a success-guaranteed site with no technical skills.
Return fron Move to Cell Excel VBA to"VBA Code Samples"
Return to our "Home page"
|