Hello
I am using Excel 2010.
I have code that Skip helped me with that takes from one worksheet and creates one worksheet per line of data on another worksheet. This works excellently:
Using the Worksheet_Change(ByVal Target As Range) I already have it that this status can change and the tab color changes accordingly but I'd like to flag certain cases right from the start with different tab colors and wonder if this is possible.
Thanks.
I am using Excel 2010.
I have code that Skip helped me with that takes from one worksheet and creates one worksheet per line of data on another worksheet. This works excellently:
Code:
Sub AbstractData()
Dim r As Range, wsAdd As Worksheet, t As Range, rSEQ_NO As Range, s As Range, myPassword As String, ws As Worksheet
If worksheetexists("1") Then
MsgBox "Abstracts have already been created"
Else
Application.EnableEvents = False
With Sheets("RawData_A")
Set rSEQ_NO = .Rows(1).Find("CaseNo")
If Not rSEQ_NO Is Nothing Then
For Each r In .Range(.[A2], .[A2].End(xlDown))
Sheets("Template").Copy After:=Sheets(Sheets.Count)
Set wsAdd = ActiveSheet
wsAdd.Name = .Cells(r.Row, rSEQ_NO.Column).Value
wsAdd.Tab _
.Color = 49407
For Each t In [From]
.Range(.Cells(r.Row, t.Value), .Cells(r.Row, t.Offset(0, 1).Value)).Copy
wsAdd.Range(t.Offset(0, 2).Value).PasteSpecial _
Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Next t
wsAdd.Range("A5:K34,B36:P60,B73:R92").HorizontalAlignment = xlLeft
wsAdd.Range("A5:K34,B36:P60,B73:R92").VerticalAlignment = xlTop
Next
End If
End With
End If
Application.EnableEvents = True
End Sub
Using the Worksheet_Change(ByVal Target As Range) I already have it that this status can change and the tab color changes accordingly but I'd like to flag certain cases right from the start with different tab colors and wonder if this is possible.
Thanks.