ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable (https://www.excelbanter.com/excel-programming/291113-variable.html)

Candy[_2_]

Variable
 

Hi guys,Thanks for answering my question. Really great
help! Well, I have another problem.

I need to define a range but the row number has to be a
variable. Supposed ws is defined as a worksheet and rw an
integer variable.

Here is the code:
ws.Range("A3:A" & rw & "'").Name = "range_name"

I got run-time error. Method 'Range of object'_worksheet
failed

What did I do wrong?
Thanks, again.

Don Guillett[_4_]

Variable
 
try
ws.Range("A3:A" & rw & "'").Name = "range_name"


rw=4
ws.Range("A3:A" & rw).Name = "range_name"



--
Don Guillett
SalesAid Software

"Candy" wrote in message
...

Hi guys,Thanks for answering my question. Really great
help! Well, I have another problem.

I need to define a range but the row number has to be a
variable. Supposed ws is defined as a worksheet and rw an
integer variable.

Here is the code:
ws.Range("A3:A" & rw & "'").Name = "range_name"

I got run-time error. Method 'Range of object'_worksheet
failed

What did I do wrong?
Thanks, again.





All times are GMT +1. The time now is 05:34 PM.

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