ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to skip cells with text strings. (https://www.excelbanter.com/excel-discussion-misc-queries/39020-how-skip-cells-text-strings.html)

mikeburg

How to skip cells with text strings.
 

What should I add to the code below to cause it to skip a cell that
contains a text string in the cell above it? I need it to only work on
numbers in the cell above it.

If ActiveCell.Offset(rowoffset:=-1) < "" Then
ActiveCell = ActiveCell.Offset(rowoffset:=-1) + 1
Application.SendKeys ("{Enter}")
End If

Thanks so much.

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=393456


Dave Peterson

You can check the cell above by:

if isnumeric(activecell.offset(-1,0)) then
'it's numeric.
else
'it's not
end if

mikeburg wrote:

What should I add to the code below to cause it to skip a cell that
contains a text string in the cell above it? I need it to only work on
numbers in the cell above it.

If ActiveCell.Offset(rowoffset:=-1) < "" Then
ActiveCell = ActiveCell.Offset(rowoffset:=-1) + 1
Application.SendKeys ("{Enter}")
End If

Thanks so much.

mikeburg

--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=393456


--

Dave Peterson


All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com