ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If cell is text, then (https://www.excelbanter.com/excel-programming/355303-if-cell-text-then.html)

achidsey

If cell is text, then
 

Excel Experts

I am writing a autosum procedure. As part of the code I want to choose the
first cell in a column that contains a number. I use .End(xlUp) to get to
the top cell.

But how do I go down one cell if the top cell is text (a column heading).

I tried

If IsText(Selection) = True Then
Selection.Offset(1)
End If

But IsText only works as a worksheet function I think.

What code would I use to say: If this cell is text, go down one cell??

Thanks,

Alan


--
achidsey

Chris Marlow

If cell is text, then
 
Hi,

Try Not IsNumeric(x).

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"achidsey" wrote:


Excel Experts

I am writing a autosum procedure. As part of the code I want to choose the
first cell in a column that contains a number. I use .End(xlUp) to get to
the top cell.

But how do I go down one cell if the top cell is text (a column heading).

I tried

If IsText(Selection) = True Then
Selection.Offset(1)
End If

But IsText only works as a worksheet function I think.

What code would I use to say: If this cell is text, go down one cell??

Thanks,

Alan


--
achidsey


Gary''s Student

If cell is text, then
 
Actually you can get to almost all worksheet functions:


Sub Macro1()
MsgBox (Application.IsText(Selection))
End Sub
--
Gary''s Student


"Chris Marlow" wrote:

Hi,

Try Not IsNumeric(x).

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"achidsey" wrote:


Excel Experts

I am writing a autosum procedure. As part of the code I want to choose the
first cell in a column that contains a number. I use .End(xlUp) to get to
the top cell.

But how do I go down one cell if the top cell is text (a column heading).

I tried

If IsText(Selection) = True Then
Selection.Offset(1)
End If

But IsText only works as a worksheet function I think.

What code would I use to say: If this cell is text, go down one cell??

Thanks,

Alan


--
achidsey


achidsey

If cell is text, then
 

That worked. Thanks Chris.

--
achidsey


"Chris Marlow" wrote:

Hi,

Try Not IsNumeric(x).

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"achidsey" wrote:


Excel Experts

I am writing a autosum procedure. As part of the code I want to choose the
first cell in a column that contains a number. I use .End(xlUp) to get to
the top cell.

But how do I go down one cell if the top cell is text (a column heading).

I tried

If IsText(Selection) = True Then
Selection.Offset(1)
End If

But IsText only works as a worksheet function I think.

What code would I use to say: If this cell is text, go down one cell??

Thanks,

Alan


--
achidsey



All times are GMT +1. The time now is 11:44 AM.

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