Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Deleting Test

  Asked By: Raju    Date: Mar 19    Category: MS Office    Views: 629
  

I have a list of data upto and over 2000 cells,
What I wish to do is search through the cells and delete the cells
which contain text i.e.

1
5
6
frame 1
7
65
55
4
frame 2

The text will vary, is it possible to use something like

If cell(1,1).value = string then
delete rows(1)

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Drew Lewis     Answered On: Mar 19

I have a list  of data  upto and over 2000 cells,
What I wish to do is search through the cells and delete the cells
which contain text i.e.

1
5
6
frame 1
7
65
55
4
frame 2

The text will vary, is it possible to use something like

If cell(1,1).value = string then
delete rows(1)

 
Answer #2    Answered By: Adalard Fischer     Answered On: Mar 19

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


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)

 
Answer #3    Answered By: Paulette Matthews     Answered 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

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




Tagged: