I have data on Sheet1 in column A which is inputted dynamically via a userform. The data exists in column A like:
I want to copy this data to sheet2 which has another set of data inputted dynamically via a second userform.
I want to copy the data, to specific cells in sheet2 which are determined by data inputted into the second userform, i.e it is dynamic and changes, so I can't reference them directly.
I have tried to fill the specific cells with dashes (-) and then replace the dashes(-) with the values in column A, but I cannot seem to cycle through the values in column A on sheet1.
This is the part of the code that I have tried using to replace the dashes with the values in column A sheet1. It runs with no errors but the dashes do not change to the values in column A.
Set r3 = Range("B2:B100") 'range where the data is sent to
For each cell3 in r3
If cell3.value = "-" Then
cell3.Value = Range("Sheet1!A2:A6") 'range where I am taking the data from
End If
Next
I know if I change the code in line 4 - Cell3.Value = Range(Sheet1!A2") all the dashes change to the value in A2. However, I need the first dash to be A2, second dash to be A3 and so on. I don't know how many values will be in column A.
Thanks.
Column A |
AB1234 |
BC1256 |
GF4567 |
I want to copy this data to sheet2 which has another set of data inputted dynamically via a second userform.
I want to copy the data, to specific cells in sheet2 which are determined by data inputted into the second userform, i.e it is dynamic and changes, so I can't reference them directly.
I have tried to fill the specific cells with dashes (-) and then replace the dashes(-) with the values in column A, but I cannot seem to cycle through the values in column A on sheet1.
This is the part of the code that I have tried using to replace the dashes with the values in column A sheet1. It runs with no errors but the dashes do not change to the values in column A.
Set r3 = Range("B2:B100") 'range where the data is sent to
For each cell3 in r3
If cell3.value = "-" Then
cell3.Value = Range("Sheet1!A2:A6") 'range where I am taking the data from
End If
Next
I know if I change the code in line 4 - Cell3.Value = Range(Sheet1!A2") all the dashes change to the value in A2. However, I need the first dash to be A2, second dash to be A3 and so on. I don't know how many values will be in column A.
Thanks.