PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Discussion Delete cells with text, and shift cells left?

Reply

Delete cells with text, and shift cells left?

 
Thread Tools Rate Thread
Old 10-11-2006, 06:19 AM   #1
Ryk
Guest
 
Posts: n/a
Default Delete cells with text, and shift cells left?


I have this from surfing here and it not work. What I have is column A

with headings, and what I copy into this would look something like this

for example....
( Used | to show cells)

Value|of|item|is|45|23|12|blah|23|16


What I need it to end up looking like is...


Value|45|23|12|23|16


It would need look for text in cells and delete those cells and shift
left over 7-8 columns.


The
Sub MoveText()
Dim rCell As Range
Dim rCheck As Range
' either select a column, range or whatever on the sheet or
' set a value
'set rCheck=selection
Set rCheck = Range("D115")
For Each rCell In rCheck
If IsDate(rCell) Then
rCell.Offset(0, -1).Delete Shift:=xlToLeft
End If
Next
Set rCell = Nothing
Set rCheck = Nothing
End Sub


The " If IsDate(rCell) Then " above I tried changing to " If
Istext(rCell) Then" but that not work. Ok Ok I am not the brightest
excel Bulb heheh.


Thanks for any help


Dave

  Reply With Quote
Old 10-11-2006, 07:40 AM   #2
Trevor Shuttleworth
Guest
 
Posts: n/a
Default Re: Delete cells with text, and shift cells left?

That code will never work for you. It is deleting cells with dates in them.

You'd need to set something up which checks for the text in the cells and
deletes them

Regards

Trevor



"Ryk" <ryk_aceofspades@hotmail.com> wrote in message
news:1163135946.029349.129250@i42g2000cwa.googlegroups.com...
>I have this from surfing here and it not work. What I have is column A
>
> with headings, and what I copy into this would look something like this
>
> for example....
> ( Used | to show cells)
>
> Value|of|item|is|45|23|12|blah|23|16
>
>
> What I need it to end up looking like is...
>
>
> Value|45|23|12|23|16
>
>
> It would need look for text in cells and delete those cells and shift
> left over 7-8 columns.
>
>
> The
> Sub MoveText()
> Dim rCell As Range
> Dim rCheck As Range
> ' either select a column, range or whatever on the sheet or
> ' set a value
> 'set rCheck=selection
> Set rCheck = Range("D115")
> For Each rCell In rCheck
> If IsDate(rCell) Then
> rCell.Offset(0, -1).Delete Shift:=xlToLeft
> End If
> Next
> Set rCell = Nothing
> Set rCheck = Nothing
> End Sub
>
>
> The " If IsDate(rCell) Then " above I tried changing to " If
> Istext(rCell) Then" but that not work. Ok Ok I am not the brightest
> excel Bulb heheh.
>
>
> Thanks for any help
>
>
> Dave
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off