View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
DennisB DennisB is offline
external usenet poster
 
Posts: 6
Default Format a rangeafter usining a userform

Bob;
I put your suggestion into my program and it now works perfectly. Your help
was very much appreciated.

I have fought with this for quite a while with no luck. Inever thought of
declaring the "LastRow" as a Range and using "Rows.Count" in the Set
statement. I am fairly new at VBA programing but I am learning a tremendous
amount with the help of this NG and people like yourself.

Thanks again.

DennisB



"Bob Phillips" wrote in message
...
Dennis,

I see what the problem is, you have declared LastRow as an object, I
thought
it was long.

Try this

Private Sub CommandButton1_Click()
Dim LastRow As Range
Dim Response As String
Dim Ts As Integer, Lu As Integer, Sheets2 As Worksheet

' Application.Visible = False
Set LastRow = Sheet1.Range("A" & Rows.Count).End(xlUp)


<<rest of Code snipped