Hi
Im trying to modify a VBA code I had.
However, I keep on getting a compile error "Expected End With". I am not that fimiliar with VBA to know whwere this "END WITH" should be placed.
Here is my code as it stands now:
The problem has only occured since I added the lines that are like this:
I will be adding more lines like the one above, so will somebody be kind enough to let me know where these "END WITH"'s should be placed in the code.
Thanks
Im trying to modify a VBA code I had.
However, I keep on getting a compile error "Expected End With". I am not that fimiliar with VBA to know whwere this "END WITH" should be placed.
Here is my code as it stands now:
Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim Rng As Range
With Worksheets("BETS")
If .Range("B16").Value = "" Then
Set Rng = .Range("B16")
ElseIf .Range("B17") = "" Then
Set Rng = .Range("B17")
Else
Set Rng = .Range("B16").End(xlDown).Offset(1, 0)
End If
With Rng
.Offset(0, 0).Value = Me.ComboBox3.Value
With .Offset(0, 1)
.Formula = "=VLOOKUP(B" & Rng.Row & ",'BETTING BANKS'!$B$16:$O$60,14,FALSE)"
.Value = .Value
.Offset(0, 4).Value = Me.ComboBox1.Value
.Offset(0, 5).Value = Me.ComboBox2.Value
With .Offset(0, 6)
.Formula = "=VLOOKUP(B" & Rng.Row & ",'BETTING BANKS'!$B$16:$N$60,12,FALSE)"
.Value = .Value
End With
End With
End With
Call sortselections
Call copy_selections
Unload Me
add_selection.Show
End Sub
The problem has only occured since I added the lines that are like this:
Code:
With .Offset(0, 1)
.Formula = "=VLOOKUP(B" & Rng.Row & ",'BETTING BANKS'!$B$16:$O$60,14,FALSE)"
.Value = .Value
I will be adding more lines like the one above, so will somebody be kind enough to let me know where these "END WITH"'s should be placed in the code.
Thanks