kspence703
New Member
- Joined
- Oct 5, 2018
- Messages
- 6
Hi, new to the site.
Am trying to name ranges through VBA. I have four columns. In row A would be the name I want to assign to the four different ranges I want the name to be assigned to all of column A and all of Column B etc. through Column D. For example..Cell A1 is titled "Unit and as such I want the range [column A] to be named "Unit" and of course would want to be able to repeat this for all other columns, changing of course based on the name in the first cell of the column.
I am able to name the first column with the following: Range("A2:A1000000").Name = "Unit"....however when I go and try and name the second column I receive a run-time error.
Let me know if anyone can help.
Thanks!
KS
Am trying to name ranges through VBA. I have four columns. In row A would be the name I want to assign to the four different ranges I want the name to be assigned to all of column A and all of Column B etc. through Column D. For example..Cell A1 is titled "Unit and as such I want the range [column A] to be named "Unit" and of course would want to be able to repeat this for all other columns, changing of course based on the name in the first cell of the column.
I am able to name the first column with the following: Range("A2:A1000000").Name = "Unit"....however when I go and try and name the second column I receive a run-time error.
Let me know if anyone can help.
Thanks!
KS