You can access the VBA environment in Excel 2011 for Mac by opening the Visual Basic editor. First, be sure that the Developer tab is visible in the toolbar in Excel. The Developer tab is the toolbar that has the buttons to open the VBA editor and create Form Controls like buttons, checkboxes, etc. Getting help with VBA code in Office 2011 for Mac You can rely on the following five principal sources of code examples, syntax help, and general programming assistance: Macro recorder: In Excel and Word, you can record your actions and then look at the code that was recorded inside the modules.
Vba Excel Mac 2011 Tutorial
easybpw
Active Member
Vba Excel For Mac 2011 Download
Hello. I know that visual basic is supported in 2011 but this code that I have listed below doesn't seem to work yet it did in Excel 2007 (not Mac). Can anyone tell me why it isn't working now? I'm not an expert and have been lucky to find bits and pieces of code in these great forums.
Thanks for all the help.
Bill
and as a side note, can someone tell me what format I need to save this file in Excel for Mac 2011 for VBA to work? That may be my problem although I've tried several different formats with no luck.
Private Sub Worksheet_BeforeSave()
'Consolidates data from the range a2:f500 for every tab except the one it's part of.
Dim wrkSheet As Worksheet
Dim rngCopy As Range
Dim lngPasteRow As Long
Dim strConsTab As String
strConsTab = ActiveSheet.Name 'Consolidation sheet tab name based on active tab.
If Sheets(strConsTab).Cells(Rows.Count, 'A').End(xlUp).Row >= 2 Then
If MsgBox('Do you want to clear the existing consolidated data in '' & strConsTab & '', vbQuestion + vbYesNo, 'Data Consolidation Editor') = vbYes Then
Sheets(strConsTab).Range('A2:f' & Cells(Rows.Count, 'A').End(xlUp).Row).ClearContents
End If
End If
Application.ScreenUpdating = False
For Each wrkSheet In ActiveWorkbook.Worksheets
If wrkSheet.Name <> strConsTab Then
Set rngCopy = wrkSheet.Range('a2:F500')
lngPasteRow = Sheets(strConsTab).Cells(Rows.Count, 'A').End(xlUp).Row + 1
rngCopy.Copy Sheets(strConsTab).Range('A' & lngPasteRow)
Application.CutCopyMode = False
End If
Next wrkSheet
Application.ScreenUpdating = True
MsgBox 'The workbook data has now been consolidated.', vbInformation, 'Data Consolidation Editor'
End Sub
Thanks for all the help.
Bill
and as a side note, can someone tell me what format I need to save this file in Excel for Mac 2011 for VBA to work? That may be my problem although I've tried several different formats with no luck.
Private Sub Worksheet_BeforeSave()
'Consolidates data from the range a2:f500 for every tab except the one it's part of.
Dim wrkSheet As Worksheet
Dim rngCopy As Range
Dim lngPasteRow As Long
Dim strConsTab As String
strConsTab = ActiveSheet.Name 'Consolidation sheet tab name based on active tab.
If Sheets(strConsTab).Cells(Rows.Count, 'A').End(xlUp).Row >= 2 Then
If MsgBox('Do you want to clear the existing consolidated data in '' & strConsTab & '', vbQuestion + vbYesNo, 'Data Consolidation Editor') = vbYes Then
Sheets(strConsTab).Range('A2:f' & Cells(Rows.Count, 'A').End(xlUp).Row).ClearContents
End If
End If
Application.ScreenUpdating = False
For Each wrkSheet In ActiveWorkbook.Worksheets
If wrkSheet.Name <> strConsTab Then
Set rngCopy = wrkSheet.Range('a2:F500')
lngPasteRow = Sheets(strConsTab).Cells(Rows.Count, 'A').End(xlUp).Row + 1
rngCopy.Copy Sheets(strConsTab).Range('A' & lngPasteRow)
Application.CutCopyMode = False
End If
Next wrkSheet
Application.ScreenUpdating = True
MsgBox 'The workbook data has now been consolidated.', vbInformation, 'Data Consolidation Editor'
End Sub