Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Raju Iyer   on Mar 19 In MS Office Category.

  
Question Answered By: Paulette Matthews   on Mar 19

I hit the wrong key & posted B4 finishing. Gotta remember not to use
Tab while posting. Full post below:

VBA has a way to tell the type of data  in a cell. It is TypeName

Here's a code snippit of mine:

> If TypeName(ActiveSheet.Cells(r, 1).Value) <> "Double" Then
> ' If non-number, abort
> Debug.Print " - - - no frequency - - -"
> Else ' Belongs to TypeName
> Debug.Print " - frequency present -"
> f = ActiveSheet.Cells(r, 1) ' Fet the freauency and...
Then I work on the number in the cell.
End If
End Sub

I'm looking in col A(1) of the currently selected row (r) for a
number (Aafrequency). If it isn't a Double float (aparently the
default Type when entering numbers from the KBD), then I abort the
routine.
A type of "String" will get you, you guessed it, a string entry. In
your case you need something like:

If TypeName(The cell youre looking in) = "String" Then
Do the delete
Else
Don't delete
End If

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

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


Tagged: