ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting cells dynamically (range/cells...) (https://www.excelbanter.com/excel-programming/414740-selecting-cells-dynamically-range-cells.html)

[email protected]

selecting cells dynamically (range/cells...)
 
Hi again,
here the short version of my problem: I get an error when writing

With ThisWorkbook.Worksheets(sheetname)
If .Cells(delivery_period_row, localloop).Value = deliveryperiod
Then
source_range
= .Range(.Cells(1,localloop), .Cells(max_timeseries_length,
localloop))

I get an error in the last line, stating "object not defined" (or
similar). What do I do wrong?

TomPl

selecting cells dynamically (range/cells...)
 
Make sure the sheet name is in quotes.
ad the word "set " to the front of the statement "source_range = ..."

I think that will work.

Tom

" wrote:

Hi again,
here the short version of my problem: I get an error when writing

With ThisWorkbook.Worksheets(sheetname)
If .Cells(delivery_period_row, localloop).Value = deliveryperiod
Then
source_range
= .Range(.Cells(1,localloop), .Cells(max_timeseries_length,
localloop))

I get an error in the last line, stating "object not defined" (or
similar). What do I do wrong?



All times are GMT +1. The time now is 12:07 PM.

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