View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Trouble Setting Range

Pablo, are you sure that RngEnd shouldn't be Dimmed as Long. I always Dim my
'last rows' as Long.
Dim RngEnd As Long

Jim gave good guidance above. I just would have changed the Data Type to
Long.

Just my two cents.

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Jim Cone" wrote:

Selection.AutoFill Destination:=Range("H5:" & RngEnd)
--
Jim Cone
Portland, Oregon USA



"Pablo"

wrote in message
I am trying to establish the end of a range but keep running into an object
error. Below is a bit of code that and the error, "Method 'Range' of object
'_Global' failed.

Dim Drng As Long
Dim RngEnd As String

Drng = ActiveSheet.Cells(Rows.Count, "G").End(xlUp).Row
....
Range("H5").Select
RngEnd = "H" & Drng

Selection.AutoFill Destination:=Range("H5:RngEnd")

Any help is appreciated.