Hello,
I have a worksheet where I need to separate out items into different columns and remove the text after ":"
The list looks like this
Breakfast: Eggs, Sausage, Toast; Lunch: Pizza, Tacos, Sandwich; Dinner: Salad, Steak
The main items (Breakfast, Lunch, Dinner) go into three different columns but the text after : needs to be deleted. I've inherited a macro that will among other things break them up into columns. (Parse the progress column is the section I'm working on. )
Thank you for any help!
I have a worksheet where I need to separate out items into different columns and remove the text after ":"
The list looks like this
Breakfast: Eggs, Sausage, Toast; Lunch: Pizza, Tacos, Sandwich; Dinner: Salad, Steak
The main items (Breakfast, Lunch, Dinner) go into three different columns but the text after : needs to be deleted. I've inherited a macro that will among other things break them up into columns. (Parse the progress column is the section I'm working on. )
VBA Code:
Sub Topic()
'
' Topic Translator Macro
'
'Parse the Bill Column
Range("D2:D15000").Select
Selection.TextToColumns Destination:=Range("D2:D15000"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
'Parse the Progress Column
Range("G2:G15000").Select
Selection.TextToColumns Destination:=Range("G2:G15000"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
'Remove the N/A values from the Bill Status fields
Range("G2:G15000").Replace What:="N/A", _
Replacement:=" ", LookAt:=xlPart, MatchCase:=False
'Replace any field with "Approved" to "Approved/Enacted"
Dim c As Range
Dim SrchRng
Set SrchRng = ActiveSheet.Range("N2:N15000")
Do
Set c = SrchRng.Find("Approved", LookIn:=xlValues)
If Not c Is Nothing Then c.Cells.Value = "DOGGIE"
Loop While Not c Is Nothing
Dim c2 As Range
Dim SrchRng2
Set SrchRng2 = ActiveSheet.Range("N2:N15000")
Do
Set c2 = SrchRng2.Find("DOGGIE", LookIn:=xlValues)
If Not c2 Is Nothing Then c2.Cells.Value = "Approved/Enacted"
Loop While Not c2 Is Nothing
'Remove all "Hard Returns" from sheet
' Dim s As String
' On Error GoTo MyReplaceAbort
' Application.DisplayStatusBar = True
' Application.StatusBar = "Replacing Characters..."
' Application.ScreenUpdating = False
' For Each c In Range("A1:AA15000").Cells
' c.Value = ReplaceCharacter(c.Value, Chr(10), " ")
' Next c
'MyReplaceAbort:
' Application.ScreenUpdating = True
' Application.StatusBar = False
' Application.DisplayStatusBar = True
End Sub
Thank you for any help!
Last edited by a moderator: