Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Question about "End(xlUp)" property
Terence,
Test the Value of the cell and move down only if it is not empty. E.g., Dim Rng As Range Set Rng = Cells(Rows.Count, "A").End(xlUp) If Rng.Value < "" Then Set Rng = Rng(2, 1) End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Terence" wrote in message ... Hi, I am writing some codes to find out the last non-empty cell in column A of my worksheet by using the code "Range ("A65536").End(xlUp).Row", then I can write something new at the next row. However, if the cell (A1) at row 1 is empty, it doesn't return 0 but 1. If I write something at the next row, then it is written to row 2 (cell A2) but leaving cell A1 empty. How should I avoid this problem? Is there any better coding method? Thanks a lot in advance!! Terence |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Object doesn't support this property or method" in Excel 2003 | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
VBA error: "object doesn't support this property or method" | Excel Discussion (Misc queries) | |||
"Disk is Full" add-on question to "Can't reset last cell" post tod | Excel Discussion (Misc queries) | |||
"Unable to set the Formula property of the Series class" with a tw | Charts and Charting in Excel |