Hi
I'm fairly new to VBA so please bear with me
I have a data set that contains a list of course names in one of the columns. For some unknown reason, the system that produces the data likes to put quotation marks around some (but not all) of the course names. I need to remove the quotation marks at the start and end of the string but not all quotation marks as there may be some legitimately contained within the course name.
I was originally going to use the following code to filter on the relvant column (ColRef) for records beginning with ".
'With Worksheets("Utilisation Regs Raw") '.AutoFilterMode = False
'.Range("A1").AutoFilter
'.Range("A1").AutoFilter Field:=Colref, Criteria1:="*"""
'End With
(sorry I don't know how to get my code in to those blue boxes - this is my 1st ever post!)
However, I then realised I didn;t know how to loop through just the filtered rows to remove the 1st and last characters from each string. I therefore decided to try using an if statement and for next loop:
For p = 2 To FinalRow
If Cells(p, Colref).Value = "*Chr(34)" Then
mystring = Cells(p, Colref).Value
Cells(p, Colref).Value = Mid(mystring, 2)
End If
Next p
However, I can't work out how to say begins with " . I tried using ="*""" but that didn't work so tried to use Chr(34) (as above). I'm hoping it's something really simple but I just don't know what the correct expression is.
Thanks in advance
I'm fairly new to VBA so please bear with me
I have a data set that contains a list of course names in one of the columns. For some unknown reason, the system that produces the data likes to put quotation marks around some (but not all) of the course names. I need to remove the quotation marks at the start and end of the string but not all quotation marks as there may be some legitimately contained within the course name.
I was originally going to use the following code to filter on the relvant column (ColRef) for records beginning with ".
'With Worksheets("Utilisation Regs Raw") '.AutoFilterMode = False
'.Range("A1").AutoFilter
'.Range("A1").AutoFilter Field:=Colref, Criteria1:="*"""
'End With
(sorry I don't know how to get my code in to those blue boxes - this is my 1st ever post!)
However, I then realised I didn;t know how to loop through just the filtered rows to remove the 1st and last characters from each string. I therefore decided to try using an if statement and for next loop:
For p = 2 To FinalRow
If Cells(p, Colref).Value = "*Chr(34)" Then
mystring = Cells(p, Colref).Value
Cells(p, Colref).Value = Mid(mystring, 2)
End If
Next p
However, I can't work out how to say begins with " . I tried using ="*""" but that didn't work so tried to use Chr(34) (as above). I'm hoping it's something really simple but I just don't know what the correct expression is.
Thanks in advance