reubanrao93
New Member
- Joined
- Dec 7, 2020
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
Hey gurus,
Greetings, I'm currently having an issue with the module here. The idea is from the column Q, replace the asterisk and asterisk dash combo into empty. However when I ran the code below, the whole column becomes blank instead. Anyone has ideas for this?
Sub Unique2()
Dim LastRow1 As Long
Dim Ws As Worksheet
Set Ws = Sheets("OUTPUT")
LastRow1 = Ws.Range("A" & Ws.Rows.Count).End(xlUp).Row
Ws.Range("q1:q" & LastRow1).Formula = "=CONCATENATE(P1,""*"")"
Sheets("OUTPUT").Range("A:Z").Copy
Sheets("OUTPUT").Range("A:Z").PasteSpecial Paste:=xlPasteValues
Ws.Range("q1:q" & LastRow1).Replace "*", ""
Ws.Range("q1:q" & LastRow1).Replace "-*", ""
End Sub
Greetings, I'm currently having an issue with the module here. The idea is from the column Q, replace the asterisk and asterisk dash combo into empty. However when I ran the code below, the whole column becomes blank instead. Anyone has ideas for this?
Column Q (Before Macro) | Column Q (After Macro) |
BKCKMU-10-1* | BKCKMU-10-1 |
BKCKMU-10-1-* | BKCKMU-10-1 |
Sub Unique2()
Dim LastRow1 As Long
Dim Ws As Worksheet
Set Ws = Sheets("OUTPUT")
LastRow1 = Ws.Range("A" & Ws.Rows.Count).End(xlUp).Row
Ws.Range("q1:q" & LastRow1).Formula = "=CONCATENATE(P1,""*"")"
Sheets("OUTPUT").Range("A:Z").Copy
Sheets("OUTPUT").Range("A:Z").PasteSpecial Paste:=xlPasteValues
Ws.Range("q1:q" & LastRow1).Replace "*", ""
Ws.Range("q1:q" & LastRow1).Replace "-*", ""
End Sub