Helo... i have a problem with VBA in excel...
ok the point is this... i was traying to make a buton, which detects some date infromation and apon them, when i click the buton some specific workbook would open and specific sheetfor 4 weeks in a month) and in every workbook i have 6 sheets(for 6 working days in a week) ... and when i use some if statements i can do that wehn i type only 3 or 4 od them, but when i type more of them i get Run time error '9' ... bla bla...i searched the web and google, and always the same answer,that maybe my sheet is wrong named,but it isn't i checked it 10 times and more... so i can paste you how this looks like ... and if someone nows where the problem is please tell me, HELP ME!!
Private Sub CommandButton1_Click()
a = Range("i12").Value
b = Range("i16").Value
If a = 1 And b = 1 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("PONEDELJEK-Motag").Select
If a = 1 And b = 2 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("TOREK-Dienstg").Select
If a = 1 And b = 3 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("SREDA-Mitwoch").Select
If a = 1 And b = 4 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("ČETRTEK-Donnerstag").Select
If a = 1 And b = 5 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("PETEK-Freitag").Select
If a = 1 And b = 6 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag.xlsm")
Worksheets("SAMSTAG-Sobota").Select
If a = 2 And b = 1 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("PONEDELJEK-Motag").Select
If a = 2 And b = 2 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("TOREK-Dienstg").Select
If a = 2 And b = 3 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("SREDA-Mitwoch").Select
If a = 2 And b = 4 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("ČETRTEK-Donnerstag").Select
If a = 2 And b = 5 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("PETEK-Freitag").Select
If a = 2 And b = 6 Then Application.Workbooks.Open ("C:\Users\path\Documents\xxx\Ruckstand\RuckstandEintrag2.xlsm")
Worksheets("SAMSTAG-Sobota").Select
'and so on for two more like this for week 3 and week4 ..
End Sub
___________
please help i need this for my job and i can't get it done for the hole day and more...