Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Below is a sample of a cell: Families with pets CHAPTER 1 I need to locate this cell, by searching for the "CHAPTER" text, extract everything but CHAPTER 1, paste it in the cell adjacent to it, leaving the original cell with "CHAPTER 1" only and "Families with pets" will be in the next cell over, then color the entire row. Here is what i have so far: from here i am at a loss. any help would be much appreciated Sub FindMoveColor() Dim rng As Range Dim cell As Range Dim start_str As Integer myword = InputBox("Enter the search string ") Mylen = Len(myword) With Worksheets(InputBox("Enter the Worksheet")) Set rng = .Range("N1", .Cells(.Rows.Count, "N").End(xlUp)) End With For Each cell In rng start_str = InStr(cell.Value, myword) If start_str Then cell.EntireRow.Interior.Color = RGB(204, 255, 204) cell.Copy cell.Offset(0, 1).PasteSpecial cell.Offset(0, 0).Value = myword cell.Offset(0, 1).Characters(start_str, Mylen).Delete End If Next End Sub God bless jsd219 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to paste in the active cell the contents of a cell from another file?? | Excel Programming | |||
Find Contents of Cell (Macro) - Help me! | Excel Programming | |||
I need a macro to find cut and paste data to new cell | Excel Discussion (Misc queries) | |||
I need a macro to find cut and paste data to new cell | Excel Discussion (Misc queries) | |||
How to open a zip file and extract its contents in a macro? | Excel Programming |