KAZSTREBOR
New Member
- Joined
- Feb 18, 2021
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hi there!
I need to delete characters generated from a report that come after the space. (eg. 1234 cds), the characters vary so I can't target specific ones.
I'm currently trying to use this code in VBA that I modified from this thread but I can't figure out why it is also deleting the first character in the cell. I'm pretty new to this so any
help is much appreciated. Thanks!
I need to delete characters generated from a report that come after the space. (eg. 1234 cds), the characters vary so I can't target specific ones.
I'm currently trying to use this code in VBA that I modified from this thread but I can't figure out why it is also deleting the first character in the cell. I'm pretty new to this so any
help is much appreciated. Thanks!
VBA Code:
Sub Test()
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim rng As Range
On Error Resume Next
For Each rng In Range("B1:B" & LastRow)
rng = Left(Mid(rng, 2, 9999), WorksheetFunction.Find(" ", rng) - 2)
Next rng
Application.ScreenUpdating = True
End Sub