Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to enter the text "The End" at the end of the worksheet in column B.
I am using ActiveCell.SpecialCells(xlLastCell).Select to find the last cell in the worksheet. Currently that is cell F379, on my next report the column may change. Whatever column the last cell turns out to be, I need to enter "The End" in the last row of Column B. Is there VBA code to goto column B in the current row? Thank you L |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are several ways, this would be an easy one:
Range("B" & ActiveCell.Row) = "The End" and if you want to avoid using the .Select method (a good idea to improve speed) then try this: Range("B" & ActiveCell.SpecialCells(xlLastCell).Row) = "The End" -- Charles Chickering "A good example is twice the value of good advice." "LilacSpokane" wrote: I need to enter the text "The End" at the end of the worksheet in column B. I am using ActiveCell.SpecialCells(xlLastCell).Select to find the last cell in the worksheet. Currently that is cell F379, on my next report the column may change. Whatever column the last cell turns out to be, I need to enter "The End" in the last row of Column B. Is there VBA code to goto column B in the current row? Thank you L |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
xlLastCell is not always accurate and generally speaking you don't want to
use it. Try something like this... Sub test() Cells(LastRow, "B").Value = "The End" End Sub Public Function LastRow(Optional ByVal wks As Worksheet) As Long If wks Is Nothing Then Set wks = ActiveSheet On Error Resume Next LastRow = wks.Cells.Find(What:="*", _ After:=wks.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row If LastRow = 0 Then LastRow = 1 End Function -- HTH... Jim Thomlinson "LilacSpokane" wrote: I need to enter the text "The End" at the end of the worksheet in column B. I am using ActiveCell.SpecialCells(xlLastCell).Select to find the last cell in the worksheet. Currently that is cell F379, on my next report the column may change. Whatever column the last cell turns out to be, I need to enter "The End" in the last row of Column B. Is there VBA code to goto column B in the current row? Thank you L |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HOW IS COLUMN "K" REFERENCED ON THE CURRENT ROW IN THE GOTO COMMAN | Excel Discussion (Misc queries) | |||
After running Find, need to goto column A of that row | Excel Programming | |||
How to goto the next available cell in a column. | Excel Programming | |||
Goto column A of the ActiveCell | Excel Programming | |||
If one column is full, goto the next column | Excel Programming |