+ Reply to Thread
Results 1 to 5 of 5

Sheet Array Help

Hybrid View

  1. #1
    Registered User
    Join Date
    04-19-2015
    Location
    Kihei Hawaii
    MS-Off Ver
    Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    43

    Sheet Array Help

    I had to modify a macro that used the following Array
    Sheets(Array("Minimum Rent Schedule", "SL Schedule", "RET Schedule", "Misc Income" _
            , "Marketing Schedule", "HVAC Schedule", "CAM Income Schedule", _
            "Other Income Schedule", "CAM-Cleaning", "CAM-Security", "CAM-R&M", "CAM-Utilities" _
            , "CAM-Admin & Insurance", "CAM-HVAC", "RET Expense", _
            "LL-Bad Debt, Legal, Prop Mgt", "LL-Office & R&M", "LL-Spec Leasing Expense", _
            "LL-Marketing", "LL-Util, Leasing, Ground Lease", "LL-Other", _
            "JV-Travel, Prof Expenses", "Capital Exp")).Select
    Sheets("Minimum Rent Schedule").Activate
            Columns("T:T").Select
            Selection.Copy
            Columns("U:U").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
           
            Columns("AM:AM").Select
            Selection.Copy
            Columns("AN:AN").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    I needed to split it into two arrays as the number of columns change on a portion of the sheets. So I assumed I could just do this, but now only the "Minimum Rent Schedule" works. What did I do wrong.

    Sheets(Array("Minimum Rent Schedule", "SL Schedule", "RET Schedule", "Misc Income" _
            , "Marketing Schedule", "HVAC Schedule", "CAM Income Schedule", _
            "Other Income Schedule")).Select
    Sheets("Minimum Rent Schedule").Activate
            Columns("s:s").Select
            Selection.Copy
            Columns("v:v").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("v3").Select
            ActiveCell.FormulaR1C1 = "Prior"
           
            Columns("AL:AL").Select
            Selection.Copy
            Columns("AO:AO").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("AO3").Select
            ActiveCell.FormulaR1C1 = "Prior"
    
    Sheets(Array("CAM-Cleaning", "CAM-Security", "CAM-R&M", "CAM-Utilities" _
            , "CAM-Admin & Insurance", "CAM-HVAC", "RET Expense", _
            "LL-Bad Debt, Legal, Prop Mgt", "LL-Office & R&M", "LL-Spec Leasing Expense", _
            "LL-Marketing", "LL-Util, Leasing, Ground Lease", "LL-Other", _
            "JV-Travel, Prof Expenses", "Capital Exp")).Select
    Sheets("CAM-Cleaning").Activate
            Columns("R:R").Select
            Selection.Copy
            Columns("U:U").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("U3").Select
            ActiveCell.FormulaR1C1 = "Prior"
           
            Columns("AK:AK").Select
            Selection.Copy
            Columns("AN:AN").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("AN3").Select
            ActiveCell.FormulaR1C1 = "Prior"

  2. #2
    Registered User
    Join Date
    04-19-2015
    Location
    Kihei Hawaii
    MS-Off Ver
    Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    43

    Re: Sheet Array Help

    Full Macro if needed

    Sub PasteValVar()
    
    'Copy and Paste Variance on Forecast
    
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    
    Dim Answer As String
        Answer = MsgBox("Do you wish to copy and paste values in the variance column? This only has to be done once at the start of the forecast month.", vbQuestion + vbYesNo, "Last Chance to Abort")
        If Answer = vbNo Then
            MsgBox "You pressed NO! Macro will Exit"
            Exit Sub
        Else
            MsgBox "You pressed Yes! Macro will run"
        End If
    'Unprotect All Sheets
    Dim wSheet As Worksheet
        On Error Resume Next
        
        For Each wSheet In Worksheets
            wSheet.Unprotect Password:="aops2019"
        Next wSheet
      
       
     Range("Forecast_Change_Total").Select
        Selection.Copy
        Range("Forecast_Change_Curr_Value").Select
        Selection.PasteSpecial Paste:=xlPasteValues
            
            
       Range("Forecast_Change_Fut_Total").Select
        Selection.Copy
        Range("Forecast_Change_Future_Value").Select
        Selection.PasteSpecial Paste:=xlPasteValues
      
    Sheets(Array("Minimum Rent Schedule", "SL Schedule", "RET Schedule", "Misc Income" _
            , "Marketing Schedule", "HVAC Schedule", "CAM Income Schedule", _
            "Other Income Schedule")).Select
    Sheets("Minimum Rent Schedule").Activate
            Columns("s:s").Select
            Selection.Copy
            Columns("v:v").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("v3").Select
            ActiveCell.FormulaR1C1 = "Prior"
           
            Columns("AL:AL").Select
            Selection.Copy
            Columns("AO:AO").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("AO3").Select
            ActiveCell.FormulaR1C1 = "Prior"
    
    Sheets(Array("CAM-Cleaning", "CAM-Security", "CAM-R&M", "CAM-Utilities" _
            , "CAM-Admin & Insurance", "CAM-HVAC", "RET Expense", _
            "LL-Bad Debt, Legal, Prop Mgt", "LL-Office & R&M", "LL-Spec Leasing Expense", _
            "LL-Marketing", "LL-Util, Leasing, Ground Lease", "LL-Other", _
            "JV-Travel, Prof Expenses", "Capital Exp")).Select
    Sheets("CAM-Cleaning").Activate
            Columns("R:R").Select
            Selection.Copy
            Columns("U:U").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("U3").Select
            ActiveCell.FormulaR1C1 = "Prior"
           
            Columns("AK:AK").Select
            Selection.Copy
            Columns("AN:AN").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            Range("AN3").Select
            ActiveCell.FormulaR1C1 = "Prior"
        
    Sheets("TI & LC").Select
            Columns("R:R").Select
            Selection.Copy
            Columns("U:U").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
           
            Columns("AK:AK").Select
            Selection.Copy
            Columns("AN:AN").Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            
        
    Sheets("NWC").Select
            Columns("S:S").Select
                Selection.Copy
            Columns("U:U").Select
                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
            
            Columns("AL:AL").Select
                Selection.Copy
            Columns("AN:AN").Select
                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
    Sheets("Escrow").Select
            Columns("S:S").Select
                Application.CutCopyMode = False
                Selection.Copy
            Columns("U:U").Select
                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
            Columns("AL:AL").Select
                Selection.Copy
            Columns("AN:AN").Select
                Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
      ' CopySaveForecastChangeData Macro
    '
    
    '
        Sheets("TBSubtotals").Select
        Range("AG5").Select
        Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
        Range("AG5:BF800").Select
        Selection.Copy
        ActiveWindow.SmallScroll Down:=-216
        Range("BG5").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            
    'Protect All Sheets
        For Each ws In ActiveWorkbook.Worksheets
    ws.Protect Password:="aops2019", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True
    ActiveSheet.EnableSelection = xlNoRestrictions
    Next ws
    
     ' Reenable Events
    
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
       
    Application.StatusBar = ""
     
        
    MsgBox "Process complete"
    
    Sheets("Menu").Select
            Range("B16").Select

  3. #3
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,079

    Re: Sheet Array Help

    Looks like you may be missing a couple of quotation marks? There are a few more potential ones, but it's hard to know without knowing the names of the sheets.

    
      "JV-Travel", "Prof Expenses", "Capital Exp")).Select
    Last edited by ByteMarks; 08-07-2024 at 11:43 AM.

  4. #4
    Registered User
    Join Date
    04-19-2015
    Location
    Kihei Hawaii
    MS-Off Ver
    Microsoft 365 MSO (Version 2404 Build 16.0.17531.20190) 64-bit
    Posts
    43

    Re: Sheet Array Help

    Unfortunately, that wasn't the issue, the Sheet Tab name is "JV-Travel, Prof Expenses"

  5. #5
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,079

    Re: Sheet Array Help

    Try removing the On Error Resume Next and see if any errors arise.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to store sheetnames in an array and copy from array to summary sheet?
    By waimea in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-21-2020, 02:25 PM
  2. [SOLVED] VBA - problem copying data from storage array to sheet array
    By jtown269269 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2020, 08:41 AM
  3. [SOLVED] Filter Array 1 with Array 2 as criteria, returning filtered data to source sheet
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-31-2019, 01:08 PM
  4. [SOLVED] Help with: Range Array SelectCase Loop delete: Array All Sheet.Names
    By dlow in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-08-2015, 07:11 PM
  5. [SOLVED] Finding Max value in one row of a 2D array (array is not pulled from sheet)
    By marrott2 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-12-2014, 06:13 PM
  6. Assign sheet value to array... and redim the array size
    By Orange.CL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2010, 07:18 AM
  7. [SOLVED] Selection to Array and Array to Sheet
    By qpg in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2006, 01:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1