Hello!
I have a worksheet with about 32 columns that I download periodically as people buy raffle tickets for an event we're putting on. In order to upload the raffle tickets to our random raffle picker application, I need to divide the bigger worksheet into individual worksheets - one sheet for each raffle item. I played with some code on my own, then did a search here and found this, which gets me partway there:
My only issue, that I can't quite figure out on my own, is that I need both column A AND column B to copy to each new worksheet, and the worksheets to be named from the value in cell C1 (well, that part is easy, lol). Each time I think I have it logically figured out, I get an error. I'm sure it's something obvious I'm missing, but my VBA skills are a little rusty.
Any help would be greatly appreciated.
Thanks,
Shari
I have a worksheet with about 32 columns that I download periodically as people buy raffle tickets for an event we're putting on. In order to upload the raffle tickets to our random raffle picker application, I need to divide the bigger worksheet into individual worksheets - one sheet for each raffle item. I played with some code on my own, then did a search here and found this, which gets me partway there:
VBA Code:
Sub copycols()
Dim LC As Long, i As Long, ws As Worksheet
With ActiveSheet
LC = .Cells(1, Columns.Count).End(xlToLeft).Column
For i = 2 To LC
Set ws = Sheets.Add(After:=Sheets(Sheets.Count))
.Columns(1).Copy Destination:=ws.Range("A1")
.Columns(i).Copy Destination:=ws.Range("B1")
ws.Name = Range("B1").Value
Next i
End With
End Sub
My only issue, that I can't quite figure out on my own, is that I need both column A AND column B to copy to each new worksheet, and the worksheets to be named from the value in cell C1 (well, that part is easy, lol). Each time I think I have it logically figured out, I get an error. I'm sure it's something obvious I'm missing, but my VBA skills are a little rusty.
Any help would be greatly appreciated.
Thanks,
Shari