I created an excel sheet to merge 3 columns into 1 string. The code should produce a string like this:
"A"; B; C; 0.000; 14.1; 4.1; 14.1; ""; 0.00; -3.1; ""; 0.00; ""; 1; 0.500; 0.000; 0.000; 0; 0.05
At its current state, the code works just fine it just that I'd like to make it a little bit more tidy and functional.
Sub WP2_Maker()
'
' Simple_WP2_Maker Macro
'
For i = 20 To Cells(Rows.Count, "B").End(xlUp).Row
Cells(i, "E").Value = Chr(34) & Cells(i, "A").Value & Chr(34) & "; " & Cells(i, "B").Value & "; " & Cells(i, "C").Value & "; " & "0.000" & "; " & "14.1" & "; " & "4.1" & "; " & "14.1" & "; " & Chr(34) & Chr(34) & "; " & "0.00" & "; " & "-3.1" & "; " & Chr(34) & Chr(34) & "; " & "0.00" & "; " & Chr(34) & Chr(34) & "; " & "1" & "; " & "0.500" & "; " & "0.000" & "; " & "0.000" & "; " & "0" & "; " & "0.05"
Next i
End Sub
Basically I have 3 columns A, B and C and when clicked generate, it populate row E with the combined string.
For now, it does the job fine but there are more features that I'd like to add.
- I added clear all button to clear the sheet for next input, because now even though I clear cell A, B, C for new input, I still need to clear cell E too. how can I make column E to automatically cleared upon clicking generate button when cells in B and/or C are blank? Saw this workaround but not sure how to implement it in my code. (Determine when two consecutive cells are blank)
- How to create a save button to save the generated string into a text format without messing with the result? I'd tried save it as tab delimited format but that added extra quotes in the strings.
- I wanted to have a drop down list/combo box showing options like circle (-2.1), small circle (-3.1) and depending on which option selected change the values in the code respectively. How can I achieve this?
Thank you.