Hi OllieB
In response to your queries...
Date formatting
My approach has been to strip the time component from the cell value then finished it off by using a recorded macro where I used Text to Columns to change the format.
If Cells(1, c) = "S_lndate" Then
Selection.Replace What:=".", replacement:="/"
Cells(1, c).Value = "Charge Date"
Range(Cells(2, c), Cells(LastRow, c)).Select
Do While r <> LastRow + 1
Dim temp As String
Dim temp2 As String
temp = Cells(r, c).Value
temp2 = Left(temp, 10)
Cells(r, c).Value = temp2
r = r + 1
Selection.TextToColumns DataType:=xlFixedWidth, _
FieldInfo:=Array(0, 4), TrailingMinusNumbers:=True
Loop
End if
Price formatting
Part of the problem is the lack of standard when the price info was originally captured on our library management system. I’ve noticed that some users used a “.” instead of “,” which was the standard we set for them (you replaced “,” with “.”).
So in the same column you could have the following:
39.99.
39.99
39,99
39
Which should be….
39.99. -->R39,99
39.99 -->R39,99
39,99 -->R39,99
39 -->R39,00
If Cells(1, c) = "S_ani" Then
Cells(1, c).Value = "Price"
Range(Cells(2, c), Cells(LastRow, c)).Select
Selection.Replace What:="(", replacement:=""
Selection.Replace What:=")", replacement:=""
Selection.Replace What:="R", replacement
Selection.Replace What:="CPLS", replacement:=""
Selection.Replace What:="CPL", replacement:=""
Selection.Replace What:="CPL", replacement:=""
Selection.Replace What:="CP", replacement:=""
Selection.Replace What:="C", replacement:=""
Selection.Replace What:=".", replacement:=","
Selection.Replace What:=", ", replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.TextToColumns , DataType:=xlDelimited, _
TextQualifier:=xlNone, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Selection.NumberFormat = "$ #,##0.00"
I thought of removing all “,” and “." But the individual user settings are still throwing me a curveball. I had a user try my List Generator on her machine and her Price field showed 00030,00 instead of R30,00. I’d like to either enforce different system settings for the duration of the macro (if that’s possible) simply because I suspect that they will be different depending on the user or at the very least fix the type of errors show above
The barcode formatting is trickier than it should be simply because the logic is a bit convoluted. I'll post more on that in a bit.
Bookmarks