View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default For Next Variable Not Being Passed Through For Second Sheet

ISTMAFB (It Seems To Me At First Blush)
that a range variable has the sheet within it, and so you
have to break it apart to use the ADDRESS part on
another sheet. This shows what I'm thinking:

Sub Sub1()
Dim rng1 As Range, rng2 As Range
Set rng1 = Sheets("Sheet1").Range("a1:b3")
MsgBox rng1.Parent.Name & " | " & rng1.Address
' same address, different sheet:
Set rng2 = Sheets("Sheet2").Range(rng1.Address)
MsgBox rng2.Parent.Name & " | " & rng2.Address
End Sub ' Dave D-C

Naji wrote:
[snip]
I am specifically referring to the line:
PreviousShiftStatus = DataRange(1).Offset(-2, -2)
This variable is only assigned for sht1, but when it goes through
sht2, it doesn't do anything. Why? Since DataRange(1) is set to cell
C4, doing this offset shouldn't this offset set it to C6 for sht1 when
it goes through it and then sht2 when it goes through as well?

[snip]