LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default vba if and goto statements

Thank you so much. I'll give this a try.

Jim

"Per Jessen" wrote:

Hi

This should do it:

Sub AAA()
If Range("g38").Value = "2 stage" Then
Range("b635").Select
Else
Sheets("Encana Blend W WS").Visible = True
ActiveWorkbook.Sheets("Encana Blend W WS").Unprotect Password:="b"
Application.Goto ActiveWorkbook.Sheets("Encana Blend W WS").Cells
(3)
ActiveWorkbook.Sheets("Encana Blend W WS").Protect Password:="b"
Sheets("Ticket Wizard").Visible = False
End If
End Sub


Regards,
Per

On 16 Jan., 23:38, bigjim wrote:
I'm using Excell 2003 and trying to write a sub that does one thing if a cell
"g43" contains the words "2 stage" then go to cell "b635" and end the sub..
If not, I want it to open another worksheet in the same workbook. Here is my
code. No matter what is in g43, it goes to the new worksheet:

If Range("g38") = "2 stage" Then GoTo line1 Else GoTo line2

line1: Range("b635").Select
GoTo Lastline

line2:

Sheets("Encana Blend W WS").Visible = True
ActiveWorkbook.Sheets("Encana Blend W WS").Unprotect Password:="b"
Application.Goto ActiveWorkbook.Sheets("Encana Blend W WS").Cells(3)
ActiveWorkbook.Sheets("Encana Blend W WS").Protect Password:="b"
Sheets("Ticket Wizard").Visible = False
Lastline:

End Sub



 
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
Nested If's vs. GoTo statements Horatio J. Bilge, Jr. Excel Programming 7 October 15th 07 06:36 PM
IF then GoTo [email protected] Excel Programming 3 November 25th 06 11:21 PM
operator statements, shorting when reusing one of the statements? KR Excel Programming 1 August 4th 05 06:20 PM
On Error Goto doesn't goto Paul Excel Programming 1 October 15th 04 03:51 PM
On Error Goto doesn't goto Paul Excel Programming 0 October 15th 04 03:05 PM


All times are GMT +1. The time now is 11:37 PM.

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

About Us

"It's about Microsoft Excel"