How to get a variable range
I guess the error is in this line
With wks.Range("V[j*96-94]:Y[j*96+1]")
untested, but try
With wks.Range("V" & (j*96-94) & ":Y" & (j*96+1))
and I am certainly not claiming that I have checked the logic for 96 item
batches
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Metin" wrote in message
...
Hallo,
I have the next macro, but it gives me an error message: "Run-time error
1004: Method 'Range' of object '_Worksheet' failed". I need a variable
range
in batches of 96 rows, but I think I defined it wrong. Please help me.
Sub Abs_Bkg2()
Dim rng As Range
Dim lRownum As Long
Dim i As Long
Dim j As Long
Dim exSh As Worksheet
Dim wks As Worksheet
Set exSh = Worksheets("raw data from spad it")
Set wks = Worksheets("Calculated Data")
lRownum = exSh.Range("A1").SpecialCells(xlCellTypeLastCell). Row
i = (lRownum - 1) / 96
For j = 1 To i
With wks.Range("V[j*96-94]:Y[j*96+1]")
.FormulaR1C1 = _
"='raw data from spad it'!RC[-7]-'Calculated Data'!R4C[16]"
End With
Next j
End Sub
Thanks,
- Metin -
|