Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Help: delete whole row if the cell does not contain string "*"


Hi all,

I am only a beginner in VBA. I have come across the problem where I
have a range of data in excel. In each rows, I want to check if the
cell in that row does contain a string "*".

If the row where the cell does not contain string "*" I want to delete
the whole row.


I am having problem in figure out how to relate each cell search if it
contains a string"*".

Can anyone give me some idea/help?

Thanks

ZenZen


--
zenzen
------------------------------------------------------------------------
zenzen's Profile: http://www.excelforum.com/member.php...o&userid=30224
View this thread: http://www.excelforum.com/showthread...hreadid=499014

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default VBA Help: delete whole row if the cell does not contain string "*"

Pseudo-code:

Loop down the column of the cells you are checking, something like...

Do
{Check Deletion criteria}
move one row down
Loop until end criteria

If the deletion criteria matches, move to the next row and then delete the
previous.

Checkcell.offset(-1,0).entirerow.delete

HTH



"zenzen" wrote in
message ...

Hi all,

I am only a beginner in VBA. I have come across the problem where I
have a range of data in excel. In each rows, I want to check if the
cell in that row does contain a string "*".

If the row where the cell does not contain string "*" I want to delete
the whole row.


I am having problem in figure out how to relate each cell search if it
contains a string"*".

Can anyone give me some idea/help?

Thanks

ZenZen


--
zenzen
------------------------------------------------------------------------
zenzen's Profile:
http://www.excelforum.com/member.php...o&userid=30224
View this thread: http://www.excelforum.com/showthread...hreadid=499014



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default VBA Help: delete whole row if the cell does not contain string "*"

when you need to delete a row, it's better to start at the last row and work
your way up.

--


Gary


"zenzen" wrote in
message ...

Hi all,

I am only a beginner in VBA. I have come across the problem where I
have a range of data in excel. In each rows, I want to check if the
cell in that row does contain a string "*".

If the row where the cell does not contain string "*" I want to delete
the whole row.


I am having problem in figure out how to relate each cell search if it
contains a string"*".

Can anyone give me some idea/help?

Thanks

ZenZen


--
zenzen
------------------------------------------------------------------------
zenzen's Profile:
http://www.excelforum.com/member.php...o&userid=30224
View this thread: http://www.excelforum.com/showthread...hreadid=499014



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA Help: delete whole row if the cell does not contain string "*"

I have a few examples here
http://www.rondebruin.nl/delete.htm

You can change the = for < to do what you want

--
Regards Ron de Bruin
http://www.rondebruin.nl


"zenzen" wrote in message
...

Hi all,

I am only a beginner in VBA. I have come across the problem where I
have a range of data in excel. In each rows, I want to check if the
cell in that row does contain a string "*".

If the row where the cell does not contain string "*" I want to delete
the whole row.


I am having problem in figure out how to relate each cell search if it
contains a string"*".

Can anyone give me some idea/help?

Thanks

ZenZen


--
zenzen
------------------------------------------------------------------------
zenzen's Profile: http://www.excelforum.com/member.php...o&userid=30224
View this thread: http://www.excelforum.com/showthread...hreadid=499014



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Help: delete whole row if the cell does not contain string "*"


Thank you everyone!

I now have some idea and will try it out


--
zenzen
------------------------------------------------------------------------
zenzen's Profile: http://www.excelforum.com/member.php...o&userid=30224
View this thread: http://www.excelforum.com/showthread...hreadid=499014

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string Raja Mahendiran S Excel Worksheet Functions 6 May 12th 10 09:10 PM
Converting "uppercase" string data to "lower case" in CSV file [email protected] Excel Discussion (Misc queries) 2 August 12th 08 08:36 PM
text string: "91E10" in csv file auto converts to: "9.10E+11" [email protected] Excel Discussion (Misc queries) 2 August 12th 08 03:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"