Pineapple_Crazy
Board Regular
- Joined
- May 2, 2017
- Messages
- 51
Hey Everyone,
Looking for some VBA help here. Basically I have this disgusting looking output from one of our management systems. I have created code to clean the data up into a presentable table format that can be utilized to draw some analysis. However, in doing so I have brought certain values into the data set rows that I would like to remove. I've developed some code to do so, shown below, but it is incredibly slow and it doesn't remove all the values at once (not really sure why?). Therefore, I need to loop through the code like 5 times in order to remove all the values I need removed. Can someone provide some assistance on how to improve this code and maybe get away from the looping? Thanks much!
Looking for some VBA help here. Basically I have this disgusting looking output from one of our management systems. I have created code to clean the data up into a presentable table format that can be utilized to draw some analysis. However, in doing so I have brought certain values into the data set rows that I would like to remove. I've developed some code to do so, shown below, but it is incredibly slow and it doesn't remove all the values at once (not really sure why?). Therefore, I need to loop through the code like 5 times in order to remove all the values I need removed. Can someone provide some assistance on how to improve this code and maybe get away from the looping? Thanks much!
Code:
Sub Find_Values_Delete()
Dim Mycell As Range
Let x = 0
Do While x < 5
Application.DisplayAlerts = False
Application.ScreenUpdating = False
For Each Mycell In Range("A1:AM100000")
If Mycell.Value = "Account #:" Then
Mycell.Delete Shift:=xlToLeft
End If
If Mycell.Value = "1099:" Then
Mycell.Delete Shift:=xlToLeft
End If
If Mycell.Value = "SSN:" Then
Mycell.Delete Shift:=xlToLeft
End If
If Mycell.Value = "Tax ID:" Then
Mycell.Delete Shift:=xlToLeft
End If
If Mycell.Value = "Null" Then
Mycell.Delete Shift:=xlToLeft
End If
Next
x = x + 1
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub