How to check cell data

J

Jeff Armstrong

I am needing to set up a test condition to test if the
activecell is a string or number. If it's a number I want
it to sum up the cells. If it's a string I want it to
copy and paste. I believe I have the correct code for the
sum and copy/paste. I just don't know what the code is
for the If test.

If activecell = <code to see if cell is some number> then
activecell.offset(rowoffset:=1,columnoffset:=0).select
activecell.application.worksheetfunction.sum(myRange)
else
activecell.copy
activecell.offset(rowoffset:=1,columnoffset:=0).select
activecell.pastespecial xlpastevalues
end if

I left out the code that sets myRange using the Range()
function. I just need to know what I can place in the
first line of code to make this work.

Jeff
 
M

Mauro Gamberini

I am needing to set up a test condition to test if the
activecell is a string or number.

If IsNumeric(ActiveCell.Value) Then
*****
Else
****
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top