Efficiently Pausing VBA Execution.
Okay, so I aprear to be getting in over my head. Fist off, I have a quick
question, do the 'event' functions only activate when that paticular event
occurs in the excel spreadsheet? And if that is true then I'm really not sure
what I'm doing :P Here is my code, and once the file opens the only thing
that happens is the "Worksheet_Open()" function (which I'm sure is what is
supposed to happen). But then when I try to change the specified cell (b25)
nothing happens. As a side note, the cell is a list that the user chooses
from. They simply pick an option from the list, and each option determines
varB to be an int number from 1 to 4. What I want it to do from there is to
automatically run the KODEA function. I just have no clue where I'm going
from here, so all the help would be greatly appreciated! Also, I can't use
inputboxes because of the large amount of data that needs to be entered at
one time (and we are talking a LARGE amount of data).
As you can see, I added debug.print statements to see what it was doing.
Public rngA As Range
Private Sub Workbook_Open()
Set rngA = Worksheets("Visc Table").Range("b25") 'Range to check for
changes
Debug.Print "rngA @ open " & rngA.Value
Debug.Print "done open"
End Sub
Private Sub Worksheet_Change(ByVal rngA As Range)
Debug.Print "rngA @ change " & rngA.Value
Dim varB 'has to be variant or it will return error at start
varB = Worksheets("Visc Table").Range("b25").Value 'list value entered
by user
Select Case varB
Case "Sweet"
varB = 1
Case "Sour"
varB = 2
Case "Sour Complex"
varB = 3
Case "Sour Complex w/ C7+ comp."
varB = 4
Case Else
Var = ""
End Select
Debug.Print "varB" & varB
Call KODEA(varB)
Debug.Print "done KODEA"
End Sub
|