View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default selecting a range

hi
not really. the variable can be put in parantheses or in can be declared.

sub test (r as string)
or
sub test()
dim r as string

either way is ok.

then in your coding...

Public Sub Worksheet_Activate()
Range("E10").value = "34567"
'Note the absent Activecell. less typing, cleaner code.
Range("B15").Select
End Sub

you might want to make use of the input box function....
Public Sub Worksheet_Activate()
dim r as string
r = inputbox("enter something")
Range("E10").value = r
Range("B15").Select
End Sub

hope this cleared things up somewhat
regards
FSt1

"Joanne" wrote:

After I put my data in cell E10, I want to goto cell B15.
What I have here in the procedure in line 3 is the line from a macro I
recorded to try to get an idea how to do this. But this line has the
value i input during recording. I will need to input a different value
on each use of the ws.
I expect I need a variable declared to allow cell value to change, but I
don't have enough knowledge to know exactly how to do it.

I'm thinking that if I declare a variable, then say activecell.value =
Myvariable, that might do it - but this is a newbie guess from other
code I've been reading. If this is right, does the variable name need to
go in the parantheses in the public sub line?

Please help

Public Sub Worksheet_Activate()
Range("E10").Activate
ActiveCell.FormulaR1C1 = "34567"
Range("B15").Select
End Sub

thank you
Joanne