OnAVBALark
New Member
- Joined
- Mar 7, 2014
- Messages
- 1
Hi! This is my first post, and I haven't been able to find the solution to my exact problem, even though I've found things that seemed similar but didn't work in my case.
I have a very nice piece of VBA that I got from Microsoft Answers: Loop thru one column, find specific text, shift right one column - Microsoft Community. I've used it tons of times already, but I need to tweak the code slightly to replicate the insert xlToRight more than once. Here's a copy of Microsoft's code:
My table was imported from a pipe-delimited file that did not account for null or blank values, so I mostly need to even up my columns by moving matching data in a cell "x" number of columns to the right.
I've tried:
And
Thanks for your help!
I have a very nice piece of VBA that I got from Microsoft Answers: Loop thru one column, find specific text, shift right one column - Microsoft Community. I've used it tons of times already, but I need to tweak the code slightly to replicate the insert xlToRight more than once. Here's a copy of Microsoft's code:
Code:
[SIZE=2][COLOR=#000000][FONT=Tahoma]'Replace the "G" with the appropriate column you wish to search'Replace "TextStringHere" with the string you want to find.[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma]
[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma]Dim myR As Range[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma]Set myR = Range("G:G").Find("TextStringHere")[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma]Do While Not myR Is Nothing[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma] myR.Insert xlToRight[/FONT][/COLOR]
[COLOR=#000000][FONT=Tahoma] Set myR = Range("G:G").FindNext[/FONT][/COLOR]
[/SIZE][COLOR=#000000][FONT=Tahoma][SIZE=2]Loop [/SIZE]
[/FONT][/COLOR]
My table was imported from a pipe-delimited file that did not account for null or blank values, so I mostly need to even up my columns by moving matching data in a cell "x" number of columns to the right.
I've tried:
Code:
myR.Insert xlToRight +2
Code:
ActiveCell.Resize(0,2)
Thanks for your help!