VBA For Extracting Part of Excel 2007 Strings Need excel VBA code to:: Cycle thr
ID: 3565857 • Letter: V
Question
VBA For Extracting Part of Excel 2007 Strings
Need excel VBA code to::
Cycle through excel 2007 spreadsheet that has unknown number of rows with layout shown in example below
Extract parts of strings in column A that are after ": ";
Move extracted parts of strings that are after ": " over 3 columns.. Example move extracted part of string to column D1
Delete ": " from original string and code ends at last row of spreadsheet
Thank you
Column A
M3 Predator: Automatically acquired M-6 Carnifex: Found duringExplanation / Answer
Hi,
Give this a try:
Sub TestMacro()
Dim rngC As Range
Dim V As Variant
For Each rngC In Intersect(ActiveSheet.UsedRange, Range("A:A"))
If rngC.Value <> "" Then
V = Split(rngC.Value, ":", 2)
rngC.Value = Application.Trim(V(0))
If UBound(V) >= 1 Then
rngC(1, 4).Value = Application.Trim(V(1))
End If
End If
Next rngC
End Subb!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.