xlup to find last row

C

Curt

Have the following macro. Need to add xlup to find last row so dont highlite
blank rows not in use. Not sure how to add to this?
Thanks All

Worksheets("Data").Activate
Range("d5:m100").Select
Selection.specialcells(xlCellTypeBlanks).Select
Selection.ClearContents
Dim blanks As Long
blanks = MsgBox(prompt:="Do you have blanks to complete?",
Buttons:=vbYesNo)
If blanks = vbYes Then
UserForm4.Hide
Userform1.Hide
Exit Sub
If blanks = vbNo Then
End If
Exit Sub
End If
 
B

Bob Phillips

Worksheets("Data").Activate
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("D5:M5").Resize(LastRow - 4).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.ClearContents
Dim blanks As Long
blanks = MsgBox(prompt:="Do you have blanks to complete?",
Buttons:=vbYesNo)
If blanks = vbYes Then
UserForm4.Hide
UserForm1.Hide
Exit Sub
If blanks = vbNo Then
End If
Exit Sub
End If


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
C

Curt

compiles fine when run get error object variable or with block variable not
set yellows LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Know there is a setting I am missing
used all settings I can think of so am lost
Thanks Again
 
C

Curt

My last post Thanks Bob got it working fine guess cryed wolf to soon. Thanks
much for your input
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Eliminate blanks while copy row and transpose 11
blank cells 1
setting delimiters 2
Trapping blanks 3
missing something 12
declaring 0
YesNo problem 1
Code won't fill to last row in table 4

Top