Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default If Cell Contains Put in another Cell

Hi, the following is all in Column A. what I'm trying to accomplish with VBA
is to search down column A and each time a cell contains "*c:\*" in the the
cell it puts the entire string of the cell to Column S and each cell down
until another cell in Column A contains *c:\*. So the first one is A1, it
finds the c:\ and puts that in S1 thru S7. then it finds the c:\ in
c:\Dennis\Docs\Fin and puts c:\Dennis\Docs\Fin in S8 and S9, then it finds
the c:\ in c:\Dennis\Internet\AIM and puts c:\Dennis\Internet\AIM in S10 thru
S21 and so on down until finds no more "*c:\*.

TIA, Dennis





c:\
06/06/2006 03:21 AM 23 AUTOEXEC.BAT
03/11/2006 07:12 AM 12,565,281 AVG7QT.DAT
05/09/2006 06:29 PM 209 boot.ini
02/26/2005 03:07 AM 0 CONFIG.SYS
05/09/2006 06:29 PM 209 Copy of boot.ini
06/04/2006 03:03 AM 27,262,976 VIRTPART.DAT
c:\Dennis\Docs\Fin
07/08/2006 03:54 PM 2,073,600 dlx.xls
c:\Dennis\Internet\AIM
11/14/2001 10:47 AM 28,672 Admin.ocm
11/14/2001 10:47 AM 28,672 advert.ocm
11/14/2001 10:47 AM 24,576 aim.exe
11/14/2001 10:47 AM 2,986 aim.odl
11/14/2001 10:47 AM 9,526 aim95.cnt
11/14/2001 10:47 AM 408,753 aim95.hlp
01/30/2001 06:04 PM 1,375 aimalert.gif
11/14/2001 10:47 AM 122,880 aimauto.exe
11/14/2001 10:47 AM 1,138,688 aimres.dll
11/14/2001 10:47 AM 36,864 aimtalk.dll
01/08/2002 12:06 PM 53,248 AlertUI.ocm
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,073
Default If Cell Contains Put in another Cell

Hi Dennis,
does this do what you want?...

Public Sub Dennis()
Application.ScreenUpdating = False
Dim ilastrow As Long
ilastrow = Range("A" & Range("A:A").Rows.Count).End(xlUp).Row
Dim I As Long
Dim vaData As Variant
For I = 1 To ilastrow
With Range("A" & I)
If Not .Find("c:\") Is Nothing Then
vaData = .Value
End If
End With
Range("S" & I).Value = vaData
Next I
End Sub


Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default If Cell Contains Put in another Cell

In article . com, "Ken Johnson" wrote:
Hi Dennis,
does this do what you want?...

Public Sub Dennis()
Application.ScreenUpdating = False
Dim ilastrow As Long
ilastrow = Range("A" & Range("A:A").Rows.Count).End(xlUp).Row
Dim I As Long
Dim vaData As Variant
For I = 1 To ilastrow
With Range("A" & I)
If Not .Find("c:\") Is Nothing Then
vaData = .Value
End If
End With
Range("S" & I).Value = vaData
Next I
End Sub


Ken Johnson

==========================
Ken , I modded ("c:\") to ("*c:\*") and it works great!!!! thanks so much for
the help!

Dennis
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,073
Default If Cell Contains Put in another Cell


Hi Dennis,

Your welcome.
Thanks for the feedback.

Ken Johnson

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
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Instead of a negative number, I'd like to show zero... Dr. Darrell Excel Worksheet Functions 6 December 7th 05 08:21 PM
Cell color based upon cell value My View Excel Discussion (Misc queries) 11 July 6th 05 03:59 AM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM


All times are GMT +1. The time now is 06:39 AM.

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"