I am attempting to insert some coding into an excel macro I have. In short, the macro has one sheet where you paste data from an external source, click a macro button, and on another sheet it does conversions and calculations as needed. It’s reused, but the coding is a one time action. What I want it to do is to look at a specific range in a column (i.e. B3:B96), that will be a text input, and have the VBA coding sequentially assign a numeric value to a blank column specified (i.e. C3:C96). But, if a value is repeated from the input, it will assign the same number to that same. The input coming in is always different and isn’t set. The repeated values, if present, will be random and at a different place each time the macro is used, and not always happen, but will most of the time.
Here’s an example of what I want it to do. In the table below, column A is the input from the and Column B is what I want as the output. If column A is blank, I want column B to also be blank.
Column A | Column B |
---|---|
Value 1 | 1 |
Value 2 | 2 |
Value 2 | 2 |
Value 3 | 3 |
Value 4 | 4 |
Value 4 | 4 |
Value 5 | 5 |
The maximum number this is going to reach is 90. This subsection of code is also going to be placed inside a group of other coding.
I am relatively new to VBA, and am not a programmer by trade or education. This macro is used for scientific data analysis. I don’t have anything I tried before, because I don’t know if what I am requesting is possible in VBA or not.
Thank you for any assistance you can give.
Rusty_S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.