Reputation: 67
I'm trying to concatenate Column C and Column H into Column F where it meets certain conditions. I want to concatenate Column C where it equals "FS_Tier_1" with Column H where it equals "FS_CAP_1_001" into Column F (below the first line "FS_Tier_1"), until Column H reaches "FS_CAP_1_002".
This is what my data looks like:
I've searched a lot of vba code but cannot find something that quite fits what I'm trying to accomplish. I mainly work in SQL Server, so I'm new to vba. I've tried to use the WHERE clause but haven't been able to make it work.
Sub Concat_ParentCode_Cap1()
With Worksheets("PD Code Structure")
Dim ParentCode As Range
Dim TierCode As String
Dim CapCode As String
TierCode = "FS_Tier_1"
CapCode = "FS_CAP_1_001"
ParentCode = Range("F2:F24")
Select Case CapCode
Case "FS_CAP_1_001"
ParentCode = TierCode & " . " & CapCode
End Select
End With
End Sub
I keep getting the error message: "Object variable or with block variable not set."
I'd like my data to look like the following:
Upvotes: 0
Views: 108