View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default selecting a range

You don't have to activate or select a cell to read or write data

from
Range("E10").Activate
ActiveCell.FormulaR1C1 = "34567"
to
Range("E10").Activate.FormulaR1C1 = "34567"

You can move through cells as follows

For RowCount = 1 to 10
Range("E" & RowCount).FormulaR1C1 = "34567"
next RowCount


For ColCount = 3 to 10
cells(3, ColCount).FormulaR1C1 = "34567"
next ColCount


Note for cells statement you can either use
cells(3,5) = 8
or
cells(3,"E") = 8



"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