Hi,

To Find the last non empty row try this syntax :

dim lastrow
lastrow = cells(rows.count,1).end(xlup).offset(1,0).row
msgbox(lastrow)

Or you can use

Dim lastrow
lastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
MsgBox (lastrow)

step 2 ( if you want to color to last row)

cells(lastrow,1).interior.color= vbgreen
Step 3 (to select multiple column)
cells(lastrow,1).resize(lastrow,2).select



On Sat, Oct 30, 2010 at 5:24 PM, Lakshitha <luxit...@gmail.com> wrote:

> I have a excel sheet where, data is distributed. I want my macro to
> find the last non empty row in the sheet. what is the best way to find
> it.
>
> In several places i saw that , "go to special --> last cell" is not
> that reliable.
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
> To post to this group, send email to excel-macros@googlegroups.com
>
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to