Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Object doesn't support this property or method" in Excel 2003 rhiski12 Excel Discussion (Misc queries) 3 November 24th 08 03:58 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
VBA error: "object doesn't support this property or method" Dave F Excel Discussion (Misc queries) 2 April 23rd 07 06:04 PM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM
"Unable to set the Formula property of the Series class" with a tw PeterQ Charts and Charting in Excel 1 February 15th 06 07:37 PM


All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"