View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] catchchatur@gmail.com is offline
external usenet poster
 
Posts: 12
Default run time error 1004 : application defined or object defined error

Experts,

I am trying to modify my range using a variable. I tried couple of
statements but everytime I am getting the same error.

If I am simply using this statement,

Set rng_wise_power_gen_Source =
wbSource.Worksheets("wise").Range("w8:w703")

the code works fine for me. But I want to modify my range based on the
input from user. basically, I just want to increase or decrease the
number or rows from the current range, with starting cell being the
same.

I tried these, but evertime I get the same error:

run time error 1004 : application defined or object defined error

These were the stuffs I tried

1.
row = 24 * (days - 31)
column = 0
Set rng_wise_power_gen_Source =
wbSource.Worksheets("wise").Range("w8:w751").Offse t(0, 0).Resize(row,
column)

2.
row = 24 * (days - 31)
column = 0
Set rng_wise_power_gen_Source =
wbSource.Worksheets("wise").Range(Cells(8, 23), Cells(row, 23))

3.
days_power_gen = 31
Set rng_power_gen_source = rng_wise_power_gen_Source.Resize(24 *
(days_power_gen - 29), 0)