View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default go to next columb

a formula can't make a cursor move to another column. it can only
work within the cell that the formula is in. you are asking for code,
but what you have written is a formula.

if you want the VBA code for such a scenario, it would be something
like this (although your description is not very specific and i don't
know if it have understood you correctly):

if worksheet("Sheet1").range("a2").value = "" then
worksheet("Sheet1").range("a2").value = "=Sheet1!B2+Sheet2!B2"
else
worksheet("Sheet1").range("a3").select
end if

but that only does it once. you'd have to set a range and then do a
For Each Next loop to go through the range cell by cell.
hope that gets you started.
:)
susan


On Dec 24, 1:30*pm, oderf wrote:
I have a template on worksheet 1, worksheet 2 is the monthly totals from the
daily. I am trying to get excel to choose the next columb if there is info in
the columb. the formula "IF(ISBLANK(a2),sheet2!b2+b2,XXX). what is the code
for XXX to get the curror to go to the next columb for the same IF statement.