SETUP:
Using ACCESS 2010 VBA to create sheets in Excel. Below issue is already working on an exported excel file;
QUESTION:
I'm having the below code (also tried varieties of it), but sadly it's changing every "-" for "_" in the entire spreadsheet instead only in the cells mentioned. I have no clue why is it happening.
For i = 2 To k
If Cells(i, 15).Value Like "*" & "-" & "*" & ":" & "*" Then
Cells(i, 15).Replace What:="-", Replacement:="_" - changes all
Cells(i, 15).Replace What:=":", Replacement:="." - changes all
End If
Next i
Highly appreciate any help. Thanks in advance!
Not sure why that's not working (I can't replicate it). Can you see if this works?
For i = 2 To k
If Cells(i, 15).Value Like "*" & "-" & "*" & ":" & "*" Then
Cells(i, 15) = Replace(Cells(i, 15), "-", "_")
Cells(i, 15) = Replace(Cells(i, 15), ":", ".")
End If
Next i