Hi,
I have a excel sheet with command button which runs VBA program.The VBA runs fine in the Excel in Windows.But for Mac it shows an error Object not found.Later only i came to know that the ActiveX controls doesnt work in the Excel 2011 Mac.
Below is the code.
Please suggest me what should I do to get the same result while using the form button.
Private Sub CommandButton1_Click() 'adding extra rows
ActiveSheet.Unprotect "password"
Application.ScreenUpdating = False
'UserForm1.Show
Dim x As Integer
'Dim Nr As Range
On Error GoTo errorhandler
x = Application.InputBox("Enter the no of rows to be inserted (1-50)", "Insert Rows", Type:=1)
If x > 0 And x <= 50 Then
i = Sheet5.Cells(22, 2)
j = Sheet5.Cells(23, 2)
Sheet3.Cells(i, j).Select
'Range(i&:&i).Select
Range(ActiveCell, ActiveCell.Offset(x - 1, 0)).EntireRow.Insert Shift:=xlDown
Sheet5.Cells(24, 2) = x + Sheet5.Cells(19, 2)
Nr = Sheet5.Cells(25, 2)
ActiveSheet.ListObjects("Table5").Resize Range(Nr)
ElseIf x < 0 And x > 51 Then
MsgBox "Enter value between 1 and 100", vbOKOnly, "Input Error"
ElseIf x = "" Then
MsgBox "Enter value between 1 and 100", vbOKOnly, "Input Error"
End If
errorhandler:
ActiveSheet.Protect "password"
End
Application.ScreenUpdating = True
ActiveSheet.Protect "password"
End Sub
Thanks and Regards,
Devpp