jme851
New Member
- Joined
- Jan 27, 2014
- Messages
- 7
I am using Excel 2010, I receivean error message "end if without block if" I've been working on this forseveral days and I have been un-successful. Can someone please tell me what Iam missing? The code is to look at what is in combox1 and based off what is selected by the user, it will locate that tab and put in the information from the userform. Thank you inadvance <o


<code> Private SubCommandButton1_Click()<o


"S:\location of file.xlsx"<o


<o


'UPDATES WORKBOOK<o


<o


Application.ScreenUpdating = False<o


<o


Workbooks.Open "S:\locationof file.xlsx"<o


<o


Set wb2 = ActiveWorkbook<o


<o


If ComboBox1.Value = "Name 1" Then<o


rowCount = Worksheets("sheet1").Range("A1").CurrentRegion.Rows.Count<o


With Worksheets("sheet").Range("A1")<o


.Offset(rowCount, 0).Value =Me.ComboBox1.Value 'NAME<o


.Offset(rowCount, 1).Value =Me.ComboBox2.Value 'TASK<o


.Offset(rowCount, 2).Value =Format(Now(), "MM/DD/YYYY") 'DATE<o


.Offset(rowCount, 3).Value =Format(Now(), "h:mm AM/PM") 'START<o


<o


If ComboBox1.Value = "Name 2" Then<o


rowCount =Worksheets("Sheet2").Range("A1").CurrentRegion.Rows.Count<o


WithWorksheets("Sheet2").Range("A1")<o


.Offset(rowCount, 0).Value =Me.ComboBox1.Value 'NAME<o


.Offset(rowCount, 1).Value =Me.ComboBox2.Value 'TASK<o


.Offset(rowCount, 2).Value =Format(Now(), "MM/DD/YYYY") 'DATE<o


.Offset(rowCount, 3).Value =Format(Now(), "h:mm AM/PM") 'START<o


<o


If ComboBox1.Value = "Name 3" Then<o


rowCount =Worksheets("Sheet3").Range("A1").CurrentRegion.Rows.Count<o


With Worksheets("Sheet3").Range("A1")<o


.Offset(rowCount, 0).Value =Me.ComboBox1.Value 'NAME<o


.Offset(rowCount, 1).Value =Me.ComboBox2.Value 'TASK<o


.Offset(rowCount, 2).Value =Format(Now(), "MM/DD/YYYY") 'DATE<o


.Offset(rowCount, 3).Value =Format(Now(), "h:mm AM/PM") 'START<o


<o


wb2.Save<o


' MsgBox "message.", vbExclamation<o


Application.ScreenUpdating = True<o


End If<o


End Sub <code> <o

