Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Please Help..Neeed VBA code to delete information in a cell

I need to delete information in cell

for example if A2= http://google.com/help/you/me

I want to remove everything after "com"

So i would want A2 = http://google.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Please Help..Neeed VBA code to delete information in a cell

Do you know beforehand what kind of entries you would be having in the
range you are considering? eg: is this all going to be
www.site.com/blah/blah, or could it be just about anything - john,
ring.tones, http://mysearch, etc ?

Joe.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Please Help..Neeed VBA code to delete information in a cell

Yes Joe all the entries will be www.site.com/blah/blah

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Please Help..Neeed VBA code to delete information in a cell

I havent yet tried the two codes that are posted here, but by the looks
of it, it should work. And in case you havent done it before, you can
have the code running for the whole column by following this logic:

Define a starting cell:

eg: define myrange = A2

Use a "Do while not isempty(myrange)

(enter your filtering code here)

Set myrange = myrange.offset(1,0)

Loop

The offset(1,0) would move your range down by one row. If you had used
offset (0,1) , it would have taken you one cell to the right in the
same row. and the loop as defined above would have the filter running
on A2, A3, A4, etc until it hits a blank cell entry.

Hope this helps.

Joe.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Please Help..Neeed VBA code to delete information in a cell

The only way that know is this you can try it.
Regards
Charles

Sub test()
'
Dim myString As String, myString2 As String
myString = Range("A2").Value
myString2 = Mid(myString, 1, InStr(InStr(InStr(myString, "/") + 1,
myString, "/") + 1, myString, "/") - 1)

End Sub


"Shani" wrote:

I need to delete information in cell

for example if A2= http://google.com/help/you/me

I want to remove everything after "com"

So i would want A2 = http://google.com




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Please Help..Neeed VBA code to delete information in a cell

I would include the the whole 'com\'

such as

Sub test()
'
Dim myString As String, myString2 As String
myString = Range("A2").Value
myString2 = Mid(myString, 1, InStr(InStr(InStr(myString, "com/") + 4,
myString, "/") + 1, myString, "/") - 1)

End Sub

that way you could assure it was after the com and avoid mistakes at the
http:// portion (if applicable)

--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.


"vqthomf" wrote in message
...
The only way that know is this you can try it.
Regards
Charles

Sub test()
'
Dim myString As String, myString2 As String
myString = Range("A2").Value
myString2 = Mid(myString, 1, InStr(InStr(InStr(myString, "/") + 1,
myString, "/") + 1, myString, "/") - 1)

End Sub


"Shani" wrote:

I need to delete information in cell

for example if A2= http://google.com/help/you/me

I want to remove everything after "com"

So i would want A2 = http://google.com




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
Delete rows if AF and AY empty but F has information Louie Excel Worksheet Functions 6 March 4th 10 09:51 PM
Delete rows in a workbook that contain the same information tiff Excel Worksheet Functions 2 February 19th 09 02:03 PM
Locking formula but delete cell information Nevada1 Excel Discussion (Misc queries) 5 October 17th 07 02:34 PM
delete some cell formulas and leave others using code john tempest Excel Worksheet Functions 0 February 23rd 06 03:51 PM
Macro to change information and then delete it Crowbar via OfficeKB.com Excel Programming 1 November 19th 05 03:49 PM


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

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

About Us

"It's about Microsoft Excel"