Click here to Skip to main content
16,008,010 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: View and Review my looping code Pin
kubben5-Jul-07 7:33
kubben5-Jul-07 7:33 
QuestionVisual Basic to Access Pin
Ronak0855-Jul-07 6:49
Ronak0855-Jul-07 6:49 
AnswerRe: Visual Basic to Access Pin
Christian Graus5-Jul-07 7:19
protectorChristian Graus5-Jul-07 7:19 
GeneralRe: Visual Basic to Access Pin
Ronak0856-Jul-07 1:21
Ronak0856-Jul-07 1:21 
AnswerRe: Visual Basic to Access Pin
jonathan155-Jul-07 7:52
jonathan155-Jul-07 7:52 
GeneralRe: Visual Basic to Access Pin
Ronak0856-Jul-07 1:33
Ronak0856-Jul-07 1:33 
AnswerRe: Visual Basic to Access Pin
haggenx5-Jul-07 10:51
haggenx5-Jul-07 10:51 
QuestionUndo not working after Worksheet_Change Sub Routine in Excel Pin
reegan415-Jul-07 6:41
reegan415-Jul-07 6:41 
In excel, I have listboxes (validation) in column A, and columb B. The ones in A work. I wrote code to check to see when there's a change in any item in A, and if the user hit 'No' on the MsgBox, then the change would be 'Undone' (ie. managed to use Undo in VB code).

My problem is, I'm using virtually the same code for column B. However, columb B's list items are a validated list depending on what was selected in A. Whenever a change is made in B, and the user hits no, Undo is NOT executed. Any ideas as to why this is happening? Here's a sample of the code that is working for A: (Note that the code I have for B is the exact same with different Range references)


'''Code start''''
Public undoCheck As Boolean
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If undoCheck Then
'do nothing
undoCheck = False
Else
Dim i As Integer
Dim rowNum As Integer
i = 10
While i < 85

If (Target.Address = "$A$" & i) And (Cells(i, 2).Value <> "" Or Cells(i, 3).Value <> "" Or Cells(i, 4).Value <> "" Or Cells(i, 5).Value <> "" Or Cells(i, 6).Value <> "" Or Cells(i, 7).Value <> "" Or Cells(i, 8).Value <> "") Then

If MsgBox("You are changing Element Data. Related Element Data will be removed but calculation data will remain. Do you wish to continue?", vbYesNo) = VbMsgBoxResult.vbYes Then
'clear values
Range("B" & i).Value = ""
Range("C" & i).Value = ""
Range("D" & i).Value = ""
Range("E" & i).Value = ""
Range("F" & i).Value = ""
Range("G" & i).Value = ""
Range("H" & i).Value = ""
Range("I" & i).Value = ""
'highlight colours
Range("C" & i).Interior.Color = vbYellow
Range("D" & i).Interior.Color = vbYellow
Range("E" & i).Interior.Color = vbYellow
Range("F" & i).Interior.Color = vbYellow
Range("G" & i).Interior.Color = vbYellow
Range("H" & i).Interior.Color = vbYellow
Range("I" & i).Interior.Color = vbYellow
undoCheck = False
Exit Sub
Else
undoCheck = True
If Application.CommandBars.FindControl(ID:=128).Enabled = True Then
Excel.Application.Undo
End If
Exit Sub
End If
End If
i = i + 1
Wend
End If
End Sub
''''Code end'''''
QuestionTopMost isnt working for me Pin
uk_nbb5-Jul-07 5:59
uk_nbb5-Jul-07 5:59 
AnswerRe: TopMost isnt working for me Pin
Christian Graus5-Jul-07 6:21
protectorChristian Graus5-Jul-07 6:21 
GeneralRe: TopMost isnt working for me Pin
uk_nbb5-Jul-07 6:36
uk_nbb5-Jul-07 6:36 
GeneralRe: TopMost isnt working for me Pin
Dave Kreskowiak5-Jul-07 15:45
mveDave Kreskowiak5-Jul-07 15:45 
AnswerRe: TopMost isnt working for me Pin
cutequencher5-Jul-07 6:22
cutequencher5-Jul-07 6:22 
AnswerRe: TopMost isnt working for me Pin
Luc Pattyn5-Jul-07 6:25
sitebuilderLuc Pattyn5-Jul-07 6:25 
GeneralRe: TopMost isnt working for me Pin
uk_nbb5-Jul-07 6:56
uk_nbb5-Jul-07 6:56 
Questiontextbox that accepts numbers only. urgent! Pin
cutequencher5-Jul-07 5:58
cutequencher5-Jul-07 5:58 
AnswerRe: textbox that accepts numbers only. urgent! Pin
cutequencher5-Jul-07 6:20
cutequencher5-Jul-07 6:20 
GeneralRe: textbox that accepts numbers only. urgent! Pin
Christian Graus5-Jul-07 6:22
protectorChristian Graus5-Jul-07 6:22 
GeneralRe: textbox that accepts numbers only. urgent! Pin
cutequencher5-Jul-07 6:28
cutequencher5-Jul-07 6:28 
QuestionCrystal Reports XI (Release 2) deployment Pin
manisghouri5-Jul-07 5:09
manisghouri5-Jul-07 5:09 
AnswerRe: Crystal Reports XI (Release 2) deployment Pin
kubben5-Jul-07 7:30
kubben5-Jul-07 7:30 
GeneralRe: Crystal Reports XI (Release 2) deployment Pin
manisghouri5-Jul-07 7:50
manisghouri5-Jul-07 7:50 
GeneralRe: Crystal Reports XI (Release 2) deployment Pin
kubben5-Jul-07 7:57
kubben5-Jul-07 7:57 
GeneralRe: Crystal Reports XI (Release 2) deployment Pin
manisghouri6-Jul-07 6:47
manisghouri6-Jul-07 6:47 
GeneralRe: Crystal Reports XI (Release 2) deployment Pin
kubben6-Jul-07 7:19
kubben6-Jul-07 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.