Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Issue with setting Range

Hi,

I'm trying to set a range to be equal to cell D2 through the last cell in
the column with a value (prior code ensures there will be no empty cells
between cell D2 and the last cell in column D with a value). I've tried the
following code which is not working...any idea how to do this?

With Sheets("Member ID Report Master")
Set Q = .Range("D2")
Set salesrange = .Range(Q, Q.End(x1down))
End With

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Issue with setting Range

One way:

With Sheets("Member ID Report Master")
Set salesrange = .Range(.Cells(2, 4), _
.Cells(.Rows.Count, 4).End(xlUp))
End With



In article ,
robs3131 wrote:

Hi,

I'm trying to set a range to be equal to cell D2 through the last cell in
the column with a value (prior code ensures there will be no empty cells
between cell D2 and the last cell in column D with a value). I've tried the
following code which is not working...any idea how to do this?

With Sheets("Member ID Report Master")
Set Q = .Range("D2")
Set salesrange = .Range(Q, Q.End(x1down))
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Issue with setting Range

It's xlDown not x1Down (EL vs One).

--
Jim
"robs3131" wrote in message
...
Hi,

I'm trying to set a range to be equal to cell D2 through the last cell in
the column with a value (prior code ensures there will be no empty cells
between cell D2 and the last cell in column D with a value). I've tried
the
following code which is not working...any idea how to do this?

With Sheets("Member ID Report Master")
Set Q = .Range("D2")
Set salesrange = .Range(Q, Q.End(x1down))
End With

--
Robert



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Issue with setting Range

Hi, robs3131

x1down should be xlDown
The 2nd character is the letter "L", not the number 1 (one),

Um....if that wasn't a typo.....then you just got an object lesson in why
you should ALWAYS put Option Explicit at the top of every module. Without
that, every variable that you misspell gets created on-the-fly, instead of
being flagged as an error. With Option Explicit, you cannot use any
variable that is not defined beforehand.

Does that help?
-------------------
Regards,

Ron
Microsoft MVP (Excel)


"robs3131" wrote in message
...
Hi,

I'm trying to set a range to be equal to cell D2 through the last cell in
the column with a value (prior code ensures there will be no empty cells
between cell D2 and the last cell in column D with a value). I've tried
the
following code which is not working...any idea how to do this?

With Sheets("Member ID Report Master")
Set Q = .Range("D2")
Set salesrange = .Range(Q, Q.End(x1down))
End With

--
Robert



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Range Name issue Barb Reinhardt Excel Programming 5 September 8th 06 04:59 PM
Range issue evil baby[_13_] Excel Programming 3 March 7th 06 03:59 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM
Range issue... James Excel Programming 4 August 4th 05 09:26 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"