View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default newbie ?: set variables, different shts, equal to each other

terry b,

DestRge.Value = SrcRge.Value

Jim Cone
San Francisco, USA


"terry b" wrote in message
ups.com...
(This is a super-simple softball lofted to the group...)
I've got a (column) range in each of 2 sheets, call them TestSrc &
TestDest. I want to have the cells in TestDest dependent on the other
sht's range, so that whenever a value's entered in, for example,
TestSrc!B2, it instantly shows up in TestDest!C2. (I know I could
manually-select the destination-cell and enter "=TestSrc!B2", but
there's a couple-hundred 'source-cells' & I'd like to automate it.)
Also: the range of cells in TestSrc sheet is in one column but is not
contiguous. I feel comfortable w/ building the looping code for this,
but am stumbling over the very basic syntax of how to set one variable
on one sht equal to a var on another--and do it so that any changes on
source sht would instantly show up on the other w/out any copying,
pasting, etc.
What I've tried:
Sub LinkCellsDiffShts()
Dim SrcRge As Range
Dim DestRge As Range
Set SrcRge = Worksheets("TestSrc").Range("B2")
Set DestRge = Worksheets("TestDest").Range("C2")
Sheets("TestDest").Range(DestRge). _
Value = Sheets("TestSrc").Range(SrcRge).Value
End Sub
I'm getting error msges from this, & don't know how to fix it.
Any help would be greatly appreciated [:-))
terry b.