View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 1,560
Default Find wildcard text within a cell

Hi,
This assumes the date is in Column C and that there is a header. Start on
the first date, which would be C2, if there is a header. The miles are
assumed to be in Column D. It also assumes you want to total Monday through
Sunday.
Sub Macro1()
StartDateWeekday = Weekday(ActiveCell.Value)
StartAddress = ActiveCell.Address
StartRow = ActiveCell.Row
Do Until ActiveCell.Value = ""
If StartDateWeekday = 1 Then
ActiveCell.Rows("2:2").EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-" & (ActiveCell.Row - StartRow) &
"]C:R[-1]C)"
ActiveCell.Offset(1, -1).Select
StartRow = ActiveCell.Row
StartDateWeekday = Weekday(ActiveCell.Value)
Else
ActiveCell.Offset(1, 0).Select
StartDateWeekday = Weekday(ActiveCell.Value)
End If
Loop
End Sub

Hope this helps.
Thanks,


"indiana1138" wrote:

Hi all,

I need to run a loop search where I find a cell in a particular column
that begins with the text, "**Item". I can do that. But when I find it,
there will be a text string of varying length inside that is bordered
by quotes, and I need to extract that string to a variable. The cell
contents will look something like this:

**Item "app04:/C/" for client "app04"

The two strings in quotes are what I need to extract. The structure of
these cells will always be the same, like:

**Item "something" for client "something"

Can anyone help? I've hit a a pothole in my brain. :)

Thanks,

Bob