Good day to all, appreciate your help on the below issue:
Trying to create a macro that first creates a new sheet naming it based on a selected cell and then apply specific values in the cells of the first row and got stuck to the point where i want to replicate specific values in consequent rows based on the values of other cells.
More specifically, my data looks like this:
The new sheet should look like below (when i choose the item 49-ITCMIL-5)
The code written so far is the following (be gentle with its format, as i'm rather new in VBA )
'Name CreateNewSheet
Sub CreateNewSheet()
'Set Dimensions
Dim rng As Range
Dim cell As Range
'Show input box to user asking for a cell
Set rng = Application.InputBox(Prompt:="Select cell range:", _
Title:="Create sheets", _
Default:=Selection.Address, Type:=8)
'Creation of the new Sheet
For Each cell In rng
If cell <> "" Then
Sheets.Add.Name = cell
End If
'ApplyHeaders
Range("A1").Value = "Size"
Range("B1").Value = "PO Nr"
Range("C1").Value = "Customer Name"
Range("D1").Value = "Delivery Fee"
Range("E1").Value = "Warehouse"
End Sub
Any recommendations on completing the coding for the requested result would be more than welcomed!
Best regards, ThanPanag
Trying to create a macro that first creates a new sheet naming it based on a selected cell and then apply specific values in the cells of the first row and got stuck to the point where i want to replicate specific values in consequent rows based on the values of other cells.
More specifically, my data looks like this:
Item Code | Small | Medium | Large |
49-ITCMIL-5 | 2 | 2 | 4 |
43-ITCMIL-7 | 3 | 1 | 5 |
50-ITCPIC-2 | 0 | 3 | 0 |
The new sheet should look like below (when i choose the item 49-ITCMIL-5)
Size | PO Nr | Customer Name | Delivery Fee | Warehouse |
Small | ||||
Small | ||||
Medium | ||||
Medium | ||||
Large | ||||
Large | ||||
Large | ||||
Large |
The code written so far is the following (be gentle with its format, as i'm rather new in VBA )
'Name CreateNewSheet
Sub CreateNewSheet()
'Set Dimensions
Dim rng As Range
Dim cell As Range
'Show input box to user asking for a cell
Set rng = Application.InputBox(Prompt:="Select cell range:", _
Title:="Create sheets", _
Default:=Selection.Address, Type:=8)
'Creation of the new Sheet
For Each cell In rng
If cell <> "" Then
Sheets.Add.Name = cell
End If
'ApplyHeaders
Range("A1").Value = "Size"
Range("B1").Value = "PO Nr"
Range("C1").Value = "Customer Name"
Range("D1").Value = "Delivery Fee"
Range("E1").Value = "Warehouse"
End Sub
Any recommendations on completing the coding for the requested result would be more than welcomed!
Best regards, ThanPanag