Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Cell Status Help

  Asked By: Kerri    Date: Sep 20    Category: MS Office    Views: 477
  

I thought that some of you may help me with this. I guess it would be
a macro.

What I'm trying to do is check if a current cell has data in it. If
it does, switch the current cell one row down.

I also need to copy the formula from the cell as it activates the next
row.

Let me know if you need more info. I'm new to Macros...

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Guadalupe Rogers     Answered On: Sep 20

More info  please:

"if a current cell  has data  in it"

Does this mean the cell is blank or has data or might it have a formula  in it
instead of data?

"copy the formula from the cell as it activates the next row"

where are you getting the formula from? The cell with no data? Or some other
cell?
do you want to copy  anything from other cells to the next row? or just select
the cell?

 
Answer #2    Answered By: Gustavo Taylor     Answered On: Sep 20

For this part you can use TypeName. It looks like this:

TypeName(sheet1.Cells(2, 1).Value)
OR
TypeName(sheet1.Range("L4").Value)

You can see it like this:
Debug.Print TypeName(sheet1.Cells(2, 1).Value)
Debug.Print TypeName(sheet1.Range("L4").Value)

The TypeName is itself a string and some of the values it can have are:
"Empty" obvious
"String" ASCII Text
"Double" a number

> If it does, switch  the current cell  one row  down.
> I also need to copy  the formula  from the cell as it activates the
next row.

Not sure what you mean here. To reference a nearby cell, there is
the Offset Property. Looks something like this:

ActiveCell.Offset(Row-offset, Column-offset)
ActiveCell.Offset(1, 0).Activate ' Step down one row & Actiate it


Putting these together, here's one solution:


If TypeName(ActiveCell.Value) <> "Empty" Then ' It's not empty
ActiveCell.Offset(1, 0).Activate ' Step down one row & Actiate it
End If

 
Didn't find what you were looking for? Find more on Cell Status Help Or get search suggestion and latest updates.




Tagged: