VBA to create a new workbook and save it in a vairable folder

jackiebmatthewsjr

New Member
Joined
Jan 17, 2019
Messages
2
I'm having an issue with a report and was wondering if any assistance can be provided. I've created a micro-enabled workbook that gives me 2 sheets of data(STEWARDS and INVENTORY REPORT) and even creates folders based on the information provided from my STEWARD sheet. I now want to create workbooks from my INVENTORY REPORT sheet that copies that report; filters and deletes values other than the items that belong to the steward; I then would to name the sheet the stewards name; I would also like to save the file as the stewards name in a folder that has already been created as the exact same name. Any advice would be greatly appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Send submitting the request I have been able to write my code doing what I intended for one person but I would like to loop this code to do this for all of the people on my spreadsheet and hopes this helps further explain. I would like to replace everything than says Matthews, Jackie to include variable information.

Code:
Dim wbNew As Workbook
    Set wbNew = Workbooks.Add
    ActiveSheet.Name = "Matthews, Jackie"
    Application.DisplayAlerts = False
    ChDir _
        "O:\Financial Services\TEST FIXED ASSETS INVENTORY\Matthews, Jackie"
    ActiveWorkbook.SaveAs Filename:= _
        "O:\Financial Services\TEST FIXED ASSETS INVENTORY\Matthews, Jackie\Matthews, Jackie.xlsx" _
        , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    Application.DisplayAlerts = False
        
    Windows("INVENTORY.xlsm").Activate
    Sheets("INVENTORY REPORT").Select
    Columns("A:Q").Select
    Selection.Copy
    Windows("Matthews, Jackie.xlsx").Activate
    ActiveSheet.Paste
    Range("A1:Q1").Select
    Selection.Font.Bold = True
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Range("A1").Select
    
    Dim i As Long
        For i = Cells(Rows.Count, "F").End(xlUp).Row To 2 Step -1
        If Cells(i, "F") <> "Matthews, Jackie" Then
        Rows(i).EntireRow.Delete
        End If
        Next i
    Application.DisplayAlerts = False
    Workbooks("Matthews, Jackie.xlsx").Close SaveChanges:=True
    Application.DisplayAlerts = False
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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