hamistasty
Board Regular
- Joined
- May 17, 2011
- Messages
- 208
I have a macro that checks the value of a cell in column A down each row & depending on the value will carry out a case. The case uses that row of data to copy and paste into a template to generate a sheet. The template depends on the value of column A, row i.
Long story short: I want to be able to put multiple values in that cell it checks seperated by spaces, & for the macro to be able to carry out multiple cases for the one row. Eg. column A & i has FIC001 FIC002 FIC003 as values, so the new code will use template FIC001, FIC002 & FIC003 (Case 1, 2 & 3) on that one row of data. Whereas currently it can only use one case (FIC001 in column A & i will use case 1 etc.)
Here's is the existing code:
Long story short: I want to be able to put multiple values in that cell it checks seperated by spaces, & for the macro to be able to carry out multiple cases for the one row. Eg. column A & i has FIC001 FIC002 FIC003 as values, so the new code will use template FIC001, FIC002 & FIC003 (Case 1, 2 & 3) on that one row of data. Whereas currently it can only use one case (FIC001 in column A & i will use case 1 etc.)
Here's is the existing code:
Code:
Sub create()
Dim ws As Worksheet, i As Long
Dim strName As String, counter As Integer
Application.ScreenUpdating = False
With Sheets("Schedule")
For i = 6 To .Range("C" & Rows.Count).End(xlUp).Row
Sheets(.Range("A" & i).Value).Copy After:=Sheet(Sheets.Count)
Set ws = ActiveSheet
ws.visible = True
strName = .Range("B" & i).Text
If Len(strName) > 0 Then
counter = 1
On Error Resume Next
Do
ws.Name = strName & IIf(counter = 1, "", " (" & counter & ")")
counter = counter + 1
Loop Until Left(ws.Name, Len(strName)) = strName
On Error GoTo 0
End If
Select Case CInt(Mid(.Range("A" & i).Value, 4, 3))
Case 1
Case 2
Case 3
End Select
Next i
End With
Sheets("Schedule").Select
Application.ScreenUpdating = True
End Sub