Hello. So, we're streamlining our product database on a CSV file, and one of the values is a custom field column that we have to implement as part of a larger project. The cells in this particular column have to be written out as a string similar to this:
"width=x;height=y;depth=z"
There are multiple fields we would have to use at variability, so sometimes it could be on one row
"width=x;height=y;depth=z;color=a"
While other times it's just
"width=x;depth=z;color=a"
Given the large number of products we need to edit in this manner, it would be cumbersome to do everything by hand. My thinking was to create a script that writes the string into the cells of this column, pulling values from other columns. The script would be something like...assuming the cell is A1, the value I'm looking to add is in C1, it would function that If C1 has a value, A1 would have Cfield=C1; Else skip and move to the next script function, If D1 has a value, A1 would have Dfield=D1, Else skip and move to the next script function, etc. The string in A1 would be written like
"Cfield=C1;Dfield=D1;Ffield=F1"
Assuming C1, D1 and F1 have values but E1 does not. And this script would run on every row with a value (or a selected range) I hope this makes sense.
I have a basic understanding of VBA (it's been years since I've touched VB, but I've used it in the past), but not enough to create a template of a script function that conforms to this idea. What would be the best way to go about this? Note that it can't be a non-macro formula like CONCATENATE since the database is scraping the values from the CSV and would likely scrape the formula instead of the value (Plus, many values would hence be removed from the CSV after the string is created).
"width=x;height=y;depth=z"
There are multiple fields we would have to use at variability, so sometimes it could be on one row
"width=x;height=y;depth=z;color=a"
While other times it's just
"width=x;depth=z;color=a"
Given the large number of products we need to edit in this manner, it would be cumbersome to do everything by hand. My thinking was to create a script that writes the string into the cells of this column, pulling values from other columns. The script would be something like...assuming the cell is A1, the value I'm looking to add is in C1, it would function that If C1 has a value, A1 would have Cfield=C1; Else skip and move to the next script function, If D1 has a value, A1 would have Dfield=D1, Else skip and move to the next script function, etc. The string in A1 would be written like
"Cfield=C1;Dfield=D1;Ffield=F1"
Assuming C1, D1 and F1 have values but E1 does not. And this script would run on every row with a value (or a selected range) I hope this makes sense.
I have a basic understanding of VBA (it's been years since I've touched VB, but I've used it in the past), but not enough to create a template of a script function that conforms to this idea. What would be the best way to go about this? Note that it can't be a non-macro formula like CONCATENATE since the database is scraping the values from the CSV and would likely scrape the formula instead of the value (Plus, many values would hence be removed from the CSV after the string is created).