Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're finding the last row, but then inserting the value into the
ActiveCell. You could use With Worksheet("Location") .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Activate End With ActiveCell.FormulaR1C1 = "hello" but why bother activating: With Worksheets("Location") .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = "hello" End With Working with the range objects directly is faster, leads to smaller code, and IMO is easier to maintain. In article , Ardy wrote: Hello All: Searching the historical posts, I have found bunch of solutions that will address the last row or maybe I should say locating the last row in terms of holding data or not null. So with that I attempted this code hoping that it will look and find the last cell in Colum A that is not null and with that it assumes that the row is right after that. So if A3 has ł123W32M1˛ the code determines that A3 is the last row and places the hello in A4. Of course I do realize that this logic assumes that we always have data in Colum A. Try #1 --------------------------------- Dim iLastRow As Integer With ActiveSheet iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row End With ActiveCell.FormulaR1C1 = "Hello" ---------------------------------- I thought this would locate the last row and cell right after the one that has data or not null from Colum A and place a hello in it. Now mind you the hello was just a test to see where the code directing the action at. It didnąt work so I tried this next one ----------------------------- Sub LastRow1() Dim LastRow As Long With Worksheets("Location") LastRow = .Cells(Rows.Count, 1).End(xlUp).Row ActiveCell.FormulaR1C1 = "Hello" End With End Sub ----------------------------- Still didnąt work. Now I am like totally confused. Any help is appreciated. Ardy |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing | Excel Discussion (Misc queries) | |||
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 | Excel Worksheet Functions | |||
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON | Excel Programming | |||
How to create/run "cell A equals Cell B put Cell C info in Cell D | Excel Discussion (Misc queries) |