Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Issues with UserForm Box

I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.



Private Sub OKBUtton_click()

Dim Cell As Range



'Monthly
If OptionMonthly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Quarterly
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A4").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Yearly
If OptionYearly Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A1").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Other
If OptionOther Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Closes dialog box
Unload UserForm2

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Issues with UserForm Box

hi,
under the "other" option, you have two ifs that start that block of code but
only one end if. Add a end if to the end of that block of code.

regards
FSt1

" wrote:

I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.



Private Sub OKBUtton_click()

Dim Cell As Range



'Monthly
If OptionMonthly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Quarterly
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A4").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Yearly
If OptionYearly Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A1").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Other
If OptionOther Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Closes dialog box
Unload UserForm2

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Issues with UserForm Box

Also under "Yearly" option you have 2 Ifs and one End If


Gord Dibben MS Excel MVP

On Tue, 19 May 2009 08:29:02 -0700, FSt1
wrote:

hi,
under the "other" option, you have two ifs that start that block of code but
only one end if. Add a end if to the end of that block of code.

regards
FSt1

" wrote:

I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.



Private Sub OKBUtton_click()

Dim Cell As Range



'Monthly
If OptionMonthly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Quarterly
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A4").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Yearly
If OptionYearly Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A1").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Other
If OptionOther Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Closes dialog box
Unload UserForm2

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Issues with UserForm Box

it would help if you indented your code more - you could see when you
are missing end if's............

'Other
If OptionOther Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If
missing end if

just a suggestion.
:)
susan



On May 19, 10:57*am, wrote:
I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.

Private Sub OKBUtton_click()

* * Dim Cell As Range

* * 'Monthly
* * If OptionMonthly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A12").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If

* * 'Quarterly
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A4").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If

* * 'Yearly
* * If OptionYearly Then
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A1").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If

* * 'Other
* * If OptionOther Then
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A12").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If

* * 'Closes dialog box
* * Unload UserForm2

End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Issues with UserForm Box

opps. missed that one.
guess i was scanning to fast.
thanks for catching that.

regards
FSt1

"Gord Dibben" wrote:

Also under "Yearly" option you have 2 Ifs and one End If


Gord Dibben MS Excel MVP

On Tue, 19 May 2009 08:29:02 -0700, FSt1
wrote:

hi,
under the "other" option, you have two ifs that start that block of code but
only one end if. Add a end if to the end of that block of code.

regards
FSt1

" wrote:

I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.



Private Sub OKBUtton_click()

Dim Cell As Range



'Monthly
If OptionMonthly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Quarterly
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A4").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Yearly
If OptionYearly Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A1").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Other
If OptionOther Then
If OptionQuarterly Then
Sheets("List").Select
Range("A3").Select
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Range("A1:A12").Select
Selection.EntireRow.Insert
ActiveCell.Select
End If

'Closes dialog box
Unload UserForm2

End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Issues with UserForm Box

On May 19, 2:36*pm, FSt1 wrote:
opps. missed that one.
guess i was scanning to fast.
thanks for catching that.

regards
FSt1



"Gord Dibben" wrote:
Also under "Yearly" option you have 2 Ifs and one End If


Gord Dibben *MS Excel MVP


On Tue, 19 May 2009 08:29:02 -0700, FSt1
wrote:


hi,
under the "other" option, you have two ifs that start that block of code but
only one end if. Add a end if to the end of that block of code.


regards
FSt1


" wrote:


I have the below as a Userform box. Can someone assist with cleaning
it up and solving my error? I get the 'Compile Error: Block If Without
End If" I have all of my End If's in, so I'm not sure where the issue
lies.


Private Sub OKBUtton_click()


* * Dim Cell As Range


* * 'Monthly
* * If OptionMonthly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A12").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If


* * 'Quarterly
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A4").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If


* * 'Yearly
* * If OptionYearly Then
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A1").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If


* * 'Other
* * If OptionOther Then
* * If OptionQuarterly Then
* * Sheets("List").Select
* * Range("A3").Select
* * ActiveCell.Offset(1, 0).Select
* * Do While Not IsEmpty(ActiveCell)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Range("A1:A12").Select
* * Selection.EntireRow.Insert
* * ActiveCell.Select
* * End If


* * 'Closes dialog box
* * Unload UserForm2


End Sub- Hide quoted text -


- Show quoted text -


I'm so sorry everyone! I didn't realize, I must have messed it up when
I copied the code. Thank you so much! Maybe it just takes another set
of eyes sometimes :)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Font Issues when using UserForm box after clicking a Checkbox RobGolf72 Excel Discussion (Misc queries) 1 October 9th 07 07:51 PM
Userform/Textbox Issues mastermind Excel Programming 2 May 21st 07 03:46 AM
Userform/TextBox Issues mastermind Excel Programming 1 May 20th 07 12:48 PM
Excel UserForm issues: Textboxes cannot be blank [email protected] Excel Programming 1 January 8th 07 09:05 AM
multi-column listbox on userform, multiple issues KR Excel Programming 2 February 15th 06 07:55 PM


All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"