Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
Menu
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
FAQFAQ
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
ProfileProfile
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search

Links
Consulting
Products

Who's Online
[ Administrator ]
[ Moderator ]


trying to reference text between worksheets.

 
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA
View previous topic :: View next topic  
Author Message
ronnierunfast



Joined: 13 Jan 2009
Posts: 1
Location: Nottingham, England

PostPosted: Tue Jan 13, 2009 6:39 am    Post subject: trying to reference text between worksheets. Reply with quote

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!!!! Crying or Very sad
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?????? Embarassed
Back to top
View user's profile Send private message
Kenneth Hobson
Gold Member
Gold Member


Joined: 25 Mar 2007
Posts: 21
Location: Tecumseh, OK

PostPosted: Wed Mar 04, 2009 10:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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