Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88126

Issue naming worksheets after cell range

$
0
0

So I am trying to use the cell values (text) in cells O2:O29 to create worksheets. When I run the macro, it creates one new worksheet for each of the colors but does not name them accordingly. My goal is to have them named accordingly.

Here is the code I have so far:

Sheets("specifiedsheet").Select
Range("A1").Select
Dim cell As Range

Dim color As Range
Set color = Sheets("specifiedsheet").Range("O2:O29")

For Each cell In color
    On Error Resume Next
        Sheets.Add.Name = cell.Value
Next cell

FYI, the data in column O is a list of colors.


Viewing all articles
Browse latest Browse all 88126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>