ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlup to find last row (https://www.excelbanter.com/excel-programming/392992-xlup-find-last-row.html)

Curt

xlup to find last row
 
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

Bob Phillips

xlup to find last row
 
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)

"Curt" wrote in message
...
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




Curt

xlup to find last row
 
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

"Bob Phillips" wrote:

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)

"Curt" wrote in message
...
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





Curt

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

"Bob Phillips" wrote:

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)

"Curt" wrote in message
...
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






All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com