View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 430
Default Calling to a specific cell

Form in a standard module:

Sub Test()
Dim flagValue As Integer
flagValue = Worksheets("Sheet1").Range("a3").Value
Worksheets("Sheet2").Range("d12").Value = flagValue
End Sub

HTH

"Kura" wrote in message
...
Eh... its much more simple than that. Basically I just
need to know how to call up a cell from sheet1 of
WorkBook1 by running a macro on sheet2 of the same
workbook.

PseudoCode run by clicking a command button on sheet2:

dim flagValue as integer
flagValue=Sheet1:a3.value
Sheet2:d12.value=flagValue

That's roughly what I'm trying to do, but I haven't been
able to figure out how to reference the specific cells. I
know how to do most other features and have a rather
extensive background with VB5, but I've never used
anything with cells like this.


-----Original Message-----
if you want to get anything done in VBA you must
study cell and range referencing.

just asking for a quick answer here wont help.

ALL vba books i ever read contain many pages on the

subject.
I woud have plenty of suggestions... except you need to

understand
rather then copy it.

Which workbook are we talking about?
the currently active workbook

=Activeworkbook
the workbook in which the code is running =Thisworkbook
or a specific workbook =Workbooks

("vbaLesson1")

How do you want to refer to the sheets?
Use the currently activesheet =ActiveSheet
Use the first sheet in the workbook =Worksheets

(1)
or a specific worksheet =Worksheets

("sheet1")

etc

you're question is ambiguous.. so this is what i make of

it:

if activesheet.name = "sheet2" then
activecell=[sheet1!a3]
else
msgbox "you're not on sheet2"
endif



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Kura" wrote:

I can't seem to find a way to place a cell's location

in
a variable or how to call a cell from another sheet.
Basically I need a macro running on sheet 2 to call A3

on
sheet1 and report the value stored there. Any

suggestions?


.