I need some assistance creating a TRIM function in VBA. I export a table to Excel and run a macro that backfills primary member data for instances of secondary members. I'm hoping to just include a trim function in the Macro, but the function needs to run for the heading columns and content.
I know this is an Access forum but I have found people on here to be very crafty with VBA as well.
Below is my macro.
Sub Macro()
Dim oname 'Output File name
Dim subssn_value
Dim subssnb4_value
Dim subfirst_value
Dim subfirstb4_value
Dim x As Integer
Dim name As String
x = 2 'counter for the row in colum B
Sheets("MemloadMetsLite").Select
For x = 2 To 445 '445 rows
subssnb4_value = Cells(x, 6)
subfirstb4_value = Cells(x, 2)
If subfirstb4_value = "" Then
subfirstb4_value = name
End If
If subssnb4_value = subssn_value Then
Cells(x, 2) = name
End If
subssn_value = subssnb4_value
name = subfirstb4_value
'If subfirstb4_value = "" And name <> Null Then
'Cells(x, 2) = name
'End If