ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Range on ThisWorkBook problem. (https://www.excelbanter.com/excel-programming/351990-set-range-thisworkbook-problem.html)

Cesar Zapata

Set Range on ThisWorkBook problem.
 
I get an error whe trying to set a range on the thisworkbook.range


dim lcolumn as string

lcolumn =
ThisWorkbook.Worksheets(2).Range("IV1").End(xlToLe ft).Offset(0,
1).Column

Set myrange = Range(ThisWorkbook.Worksheets(2).Cells(1, 24),
ThisWorkbook.Worksheets(2).Cells(1, lcolumn))

TIA


CZ


Dave Peterson

Set Range on ThisWorkBook problem.
 
First, lColumn should be a Long--or at least a number.

And second, when I changed that, your code worked ok.

Cesar Zapata wrote:

I get an error whe trying to set a range on the thisworkbook.range

dim lcolumn as string

lcolumn =
ThisWorkbook.Worksheets(2).Range("IV1").End(xlToLe ft).Offset(0,
1).Column

Set myrange = Range(ThisWorkbook.Worksheets(2).Cells(1, 24),
ThisWorkbook.Worksheets(2).Cells(1, lcolumn))

TIA

CZ


--

Dave Peterson


All times are GMT +1. The time now is 07:10 AM.

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