LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Problems with select case

Hi everyone



I am having problems modifying a Select Case structure -

My existing code runs fine (included below) but I cannot modify it to do
what I want.



I have a textbox on a Userform. A password is added by the user then a
CommandButton clicked to run the code.



3 different passwords can be used which run 3 different pieces of code



If I put the passwords directly into the code it works, however I want to
refer to the passwords as MyPassword1, MyPassword2 and MyPassword3 because
then I am referring to cell values (which can be changed without the need
for altering code!) I use MyPassword1 =
Sheets("Lists").Range("AB2").Value and declare MyPassword as a variable



Can anyone help?



Kenny using Win Me, 2000 and XP with Excel 97 and 2000







Heres part of the code



Select Case LogEntry.TextBox6.Value



'Case Sheets("Lists").Range("AB2").Value: ActiveCell.Offset(0, 14).Value =
MyName1 ' this line failed!

'Case MyPassword1: ActiveCell.Offset(0, 14).Value = MyName1
' this line failed!

Case "1312": ActiveCell.Offset(0, 14).Value = MyName1
'this line works!

LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")

ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value

ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value



ThisWorkbook.Save



MyClearBoxes





Case "002": ActiveCell.Offset(0, 14).Value = "Karl Eason"

LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")

ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value

ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value



ThisWorkbook.Save



MyClearBoxes





Case "2505": ActiveCell.Offset(0, 14).Value = "Andrew Cooper"

LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")

ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value

ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value



ThisWorkbook.Save



MyClearBoxes





Case Else:



MsgBox "Password failed - Unable to show as RECTIFIED"

ActiveCell.Offset(0, 14).Value = ""

ActiveCell.Offset(0, 12).Value = ""

ActiveCell.Offset(0, 11).Value = ""


 
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
select case Hein Excel Discussion (Misc queries) 5 November 24th 09 01:19 PM
Select case Hein Excel Discussion (Misc queries) 2 October 22nd 08 07:06 AM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case Jeff Excel Discussion (Misc queries) 1 February 27th 06 02:56 PM
select case help please Christine Flott[_2_] Excel Programming 4 July 29th 03 09:05 PM


All times are GMT +1. The time now is 06:12 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"