If not numeric

Luapo

Board Regular
Joined
Sep 12, 2005
Messages
69
I would like to know if its possible to have an If statement saying something like this in VBa

If the active cell is not numeric (or is alpha, doesnt matter which) Then

move the active cell to the right one square

end if

Thankyou very much :)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Perhaps:

Code:
Sub test()
If Not (IsNumeric(ActiveCell)) And ActiveCell.Column <> 256 Then ActiveCell.Offset(, 1).Select
End Sub
 
Upvote 0
Thankyou both HOTPEPPER and Andrew, but I used Andrew's code as I found it much simpler.
 
Upvote 0
Another question now. If I have been moving the active cell about by using offset, if I want to find out where the cell is, how do I do that. Whether it is in A1 form or 1, 1 it doesn't matter.

Cheers again :)
 
Upvote 0
Luapo said:
Another question now. If I have been moving the active cell about by using offset, if I want to find out where the cell is, how do I do that. Whether it is in A1 form or 1, 1 it doesn't matter.

Cheers again :)

Like this?

MsgBox ActiveCell.Address
 
Upvote 0
yeah that is great, now is there a way to separate the row number so I can use it as a variable?
 
Upvote 0
Question is, why are you moving the activecell about using offset.. To what purpose? Is there an underlying issue we need to address here?
 
Upvote 0
Or, let's say you actually declare your variables ...

Code:
Dim myVar as Long
'... other code ...
myVar = Activecell.Row

I'm still rather curious as to what you're trying to do..
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,328
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top