ExcelAnonymous
New Member
- Joined
- Oct 2, 2018
- Messages
- 1
I am stuck with a VBA code and badly need your help. Here's what I am trying to achieve -
Step 1 : I have to iteratively capture strings in column D (the count of which is mentioned in C2 which will change depending on the data set) - Done
Step 2 : Each of these strings will be split based on "_" and I have to re-combine them since I only need the 2nd, 1st, 3rd, 5th part (in that particular order) - represented further down in column D under 'Output' - Done
Step 3 : I have to join the newly made string in column D and strings in column F and create all possible combinations - represented further down in column F under 'Output' - Done
Step 4 : Supply all created combinations to range C in a different sheet (stuck at this step)
Below is the part of code I created. What I am struggling with is, assigning the values in temp(j,k) to a continual range in a different sheet. While j, k have values less than 2 or 3, the range should have values populated in C2:C7. A third loop is conflicting with the already present nested loop. Any help is highly appreciated!
For j = 1 To a_count
For k = 1 To c_count
Next j
Step 1 : I have to iteratively capture strings in column D (the count of which is mentioned in C2 which will change depending on the data set) - Done
Step 2 : Each of these strings will be split based on "_" and I have to re-combine them since I only need the 2nd, 1st, 3rd, 5th part (in that particular order) - represented further down in column D under 'Output' - Done
Step 3 : I have to join the newly made string in column D and strings in column F and create all possible combinations - represented further down in column F under 'Output' - Done
Step 4 : Supply all created combinations to range C in a different sheet (stuck at this step)
Below is the part of code I created. What I am struggling with is, assigning the values in temp(j,k) to a continual range in a different sheet. While j, k have values less than 2 or 3, the range should have values populated in C2:C7. A third loop is conflicting with the already present nested loop. Any help is highly appreciated!
For j = 1 To a_count
For k = 1 To c_count
iet_string = Sheet7.Range("D" & j + 1)
oet_array() = Split(iet_string, "_")
assub_string = oet_array(2) & “_” & oet_array(3) & “_” & oet_array(4) & “_” & oet_array(5)
ic_string = Sheet7.Range("F" & k + 1)
a_string = csub_string & “_” & assub_string & “_” & ic_string
temp(j, k) = a_string
Debug.Print j, k, temp(j, k)
Next k oet_array() = Split(iet_string, "_")
assub_string = oet_array(2) & “_” & oet_array(3) & “_” & oet_array(4) & “_” & oet_array(5)
ic_string = Sheet7.Range("F" & k + 1)
a_string = csub_string & “_” & assub_string & “_” & ic_string
temp(j, k) = a_string
Debug.Print j, k, temp(j, k)
Next j