View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Getting Compile error - on this line

try this
Set rng = Range("D2:D" & Lrow)
or
rng = Range("D2:D" & Lrow)


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jim May" wrote in message
...
John - Thanks, but I'm still getting Compile error with your recommended
changes
made - here is my latest code

Dim rng As Range
Dim Lrow As Integer
Lrow = Cells(Rows.Count, "D").End(xlUp).Row
Set rng = Range("D2:D & Lrow & ")"

"John Bundy" wrote:

Try putting spaces on both sides of your first &. Typically to make
troubleshooting easier, set a variable to the value then use it like
this:

LastRow=Cells(rows.count,"D").end(xlUp).row
Set rng = Range("D2:D" & LastRow & ")"

just all around easier that way.
--
-John
Please rate when your question is answered to help us and others know
what
is helpful.


"Jim May" wrote:

Set rng = Range("D2:D"&Cells(rows.count,"D").end(xlUp).row & ")"

When I extract only
Cells(rows.count,"D").end(xlUp).row and drop it in the Immediate
window
preceeded with a ?

I get 9 << the correct row number

Can someone assist?