VBA to copy, rename and hyperlink worksheets from master list

padadof2

New Member
Joined
Jan 11, 2010
Messages
44
I have a workbook that has a sheet named "Bid Sheet" and on this sheet will have multiple items that I need to copy an existing worksheet and rename it from this list. I would also like to hyperlink the new worksheet to the list on the bid sheet as well as hyperlink a couple cells to the bid sheet from the newly created copy. I have attached a worksheet of what I'm looking for. This is the code I've started. One of the problems I have encountered is that the cost and markups are on different cells depending on the worksheet. I was trying to make something to loop through my visible worksheets and then links them to the bid sheet.
Code:
Public Sub CopyOmaxsBidSheets()
    Dim wks As Worksheet
    Set wks = ActiveSheet
    Dim xcell As Range
    Dim xRg As Range
    On Error Resume Next
    Set xRg = Application.InputBox("Please select the items to create bid sheet for:", "Do It", , , , , , 8)
   
    Sheets("0MAX2RE").Visible = True
   
        If xRg Is Nothing Then Exit Sub
            For Each xcell In xRg
                If xcell.Value <> "" Then
                    Sheets("0MAX2RE").Copy After:=Worksheets(Sheets.Count)
                    ActiveSheet.Name = Left(xcell.Value, 30)
                        If Err.Number = 1004 Then
                            ActiveSheet.Name = Right(xcell.Value, 30)
                        End If
                End If
            Next
           
    Sheets("0MAX2RE").Visible = False
End Sub
TestWorkbook.xlsm
ABCDEFGH
1Name
2location
3Job
4
5
6
7
8Item #DescriptionQuantityUnitsUnit CostCostMarkupTotal Price
9Repair Cracks100LF$ - 
10Repair Spalls150SF$ 37.04$ 5,555.270.63$ 8,817.89
11Epoxy Overlay2000SY$ - 
12Concrete Bridge Deck Repair, Type 2125SF$ - 
13Concrete Bridge Deck Repair, Type 3155SF$ - 
14Foundation Repairs1LS$ - 
15    
16I'd Like to create new worksheets from this list and then hyperlink them, and also automatically link the cost/markup areas
17    
Bid Sheet
Cell Formulas
RangeFormula
A1A1=NAME
A2A2=LOC
A3A3=ECMS
G9,G11:G15,G17G9=IF(F9="","",0.63)
H9:H15,H17H9=IF(F9="","",F9/G9)
G10G10='Repair Spalls'!C25
F10F10='Repair Spalls'!D22
E17,E9:E15E9=IFERROR((F9/C9),"")
B15B15=IFERROR(VLOOKUP(item7, #REF!,4,FALSE),"")
D15D15=IFERROR(VLOOKUP(item7, #REF!,3,FALSE),"")
B17B17=IFERROR(VLOOKUP(item9, #REF!,4,FALSE),"")
D17D17=IFERROR(VLOOKUP(item9, #REF!,3,FALSE),"")
Named Ranges
NameRefers ToCells
ECMS=Index!$C$8A3
item7='Bid Sheet'!$A$15D15, B15
item9='Bid Sheet'!$A$17D17, B17
LOC=Index!$C$7A2
NAME=Index!$C$6A1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3Cell Value=0textNO

TestWorkbook.xlsm
BCD
21MARK-UP0.5311158.50
220.639387.31
Crack Repair
Cell Formulas
RangeFormula
D21D21=D19/C21
D22D22=D19/C22


The markup and cost areas area always to the right of the "MARK-UP" text, so I thought I could loop through my visible sheets and then link them? Hopefully this makes sense. Thanks in advance for any assistance.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,828
Messages
6,181,210
Members
453,023
Latest member
alabaz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top