|
Anthony's VBA Forum Where the knowledge is shared |
|
|
View previous topic :: View next topic |
Author |
Message |
ronnierunfast
Joined: 13 Jan 2009 Posts: 1 Location: Nottingham, England
|
Posted: Tue Jan 13, 2009 6:39 am Post subject: trying to reference text between worksheets. |
|
|
i am new to VBA and having real difficulty in referencing data from w/s1 to w/s2.
on previous prototypes its worked, but since i've revised the program with more commands, it isn't working as prototype.
i've been on this for ages now and its frustrating!!!!
it seems to be originally i had w/s2 cell as activecell. after revising the program i had to use activecell further down the program. therefore i need to use a datum or name for the w/s2 cell so i can use:
activesheet = sht 'w/s selected dependant on tick boxes from form
activecell = cl 'cell selected dependant on tick boxes from form
then various other commands etc. including set bal=currentcell.Offset(0, 4).Value 'this worksheet is not variable and can't be selected from form
sht.Select
cl.Select
currentcell.Offset(0, 3).Value = bal 'bal value is set
can anyone help as i've been going round in circles, even though i know it is something soooo simple that i'm missing?????? |
|
Back to top |
|
|
Kenneth Hobson Gold Member
Joined: 25 Mar 2007 Posts: 21 Location: Tecumseh, OK
|
Posted: Wed Mar 04, 2009 10:58 pm Post subject: |
|
|
Welcome to the forum!
Maybe something like:
[code]Sub Test()
Dim sht2 As Worksheet
Set sht2 = ThisWorkbook.Worksheets("Sheet2")
sht2.Range("A1").Value = ActiveCell.Value
End Sub[/code] |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|