Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
an example:
dim lastrow as long lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row range("A" & lastrow).value = 1 -- Gary "edward0380" wrote in message ... I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this will do but why do you want to select. Try to write code that does not
require any selections. lastrow=cells(rows.count,"a").end(xlup).row cells(lastrow,"a").select or cells(lastrow,"a")=cells(44,4).value -- Don Guillett SalesAid Software "edward0380" wrote in message ... I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
range("a1").Offset(sheet1.UsedRange.Row-1).Select
Replace sheet1 with the sheet object name. -- http://HelpExcel.com 1-888-INGENIO 1-888-464-3646 x0197758 "edward0380" wrote: I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
UsedRange can be unreliable for finding the last known row/column. Also, Rows.Count/End(xlUp) will not look at formulas which return a null value. -- Regards, Zack Barresse, aka firefytr, (GT = TFS FF Zack) To email, remove the NO SPAM. Please keep correspondence to the board, as to benefit others. "galimi" wrote in message ... range("a1").Offset(sheet1.UsedRange.Row-1).Select Replace sheet1 with the sheet object name. -- http://HelpExcel.com 1-888-INGENIO 1-888-464-3646 x0197758 "edward0380" wrote: I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The previous replies are all ok, but they might not be exact.
I have used the following function for years now, and it ALWAYS give steh correct result. I got it from Rob Bovey and then added a few lines Function Goto_Last(strRange, int_col, int_row) On Error Resume Next Application.ScreenUpdating = False Cells(Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row, _ Cells.Find("*", Range("A1"), , , xlByColumns, xlPrevious).column).Select If Err.Number < 0 Then MsgBox "No data in sheet" Application.ScreenUpdating = True strRange = ActiveCell.AddressLocal int_col = ActiveCell.column int_row = ActiveCell.Row End Function You just add a line to your macro to call the function, and then use the data it returns. -- Alan Hutchins "edward0380" wrote: I want to have a macro that will select the cell in the last row in column A. How do I do that? -- edward0380 ------------------------------------------------------------------------ edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396 View this thread: http://www.excelforum.com/showthread...hreadid=511077 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
row selecting | Excel Worksheet Functions | |||
Selecting the Same | Excel Discussion (Misc queries) | |||
Selecting | Excel Discussion (Misc queries) | |||
VBA - Selecting a Row | Excel Discussion (Misc queries) | |||
Selecting The Last Row | Excel Programming |