ActiveWindow.ScrollColumn (Question)

  • Thread starter Thread starter DMP
  • Start date Start date
D

DMP

I have this macro active in my worksheet and at times I
need to turn it off. Is there a way to do this without
going into the code and commenting it out??

Thanx

ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 36
 
DMP,

Not sure what your code is doing, but you can use a conditional based on the
value of a cell:

If Range("A1").Value = "This" Then
ActiveWindow.ScrollColumn = 8
ElseIf Range("A1").Value = "That" Then
ActiveWindow.ScrollColumn = 36
End If

HTH,
Bernie
MS Excel MVP
 
Hmm....what it really does is it just lets me scroll over
without using my scroll bar...there is a lot of data
between the scroll values so it makes me work faster but
there are times when I need ot look at that data in
between then scroll range so I need to turn off that macro
at will instead of doing the comment out thing..

DMP
 
DMP,

How is that macro run? It's hard to make something work with existing code
if we don't know what the existing code is or how it is used... as part of
an event, or a button on a commandbar, or a button on your worksheet, or....

HTH,
Bernie
MS Excel MVP
 
Okay let me see if I can explain....I enter a date and
then click the next cell, the macro will then scroll the
page for me to my next entry point...so it just runs in
the background...my trigger in clicking any cell in my
data entry path

DMP
 
DMP,

Post the code that you use - let me re-state: It's hard to make something
work
with existing code if we don't know what the existing code is....

HTH,
Bernie
MS Excel MVP
 
I'm sorry ..here is the code behind my data sheet...

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
'After user enters the incident number and clicks the next
cell, the sheet
'scrolls over so the user can change the incident owner.

ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 36

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("K2:K2290")) Is Nothing Then
Exit Sub
End If

Select Case Target.Value
Case "Bad Formula"
Target.Interior.ColorIndex = 7
Case "Duplicate Record"
Target.Interior.ColorIndex = 6
Case "Java Error"
Target.Interior.ColorIndex = 46
Case "Zero Byte File"
Target.Interior.ColorIndex = 33
Case "Msg Not Recorded"
Target.Interior.ColorIndex = 44
Case "C29 Invalid Float"
Target.Interior.ColorIndex = 17
Case "Data Input Error"
Target.Interior.ColorIndex = 35
Case "Missing Digit"
Target.Interior.ColorIndex = 4
Case "Incomplete File"
Target.Interior.ColorIndex = 15
Case "Input Extra Space"
Target.Interior.ColorIndex = 12
Case Else
Target.Interior.ColorIndex = xlColorIndexNone

'more case statements in the same order
End Select

End Sub

As stated I am trying to have it turn scrolling off and on
without going in an commenting it out....


Thanx
 
DMP,

Your code always sets the ScrollColumn to 36, any time the selection is
changed. Seems broken to me.

How about simply using the Worksheet_Change event to control the scrolling?
That way, only changing a value will scroll you over to the other column,
which is what you would want to do if you were changing values. When you
want to simply change cells to look around, you won't scroll, and you can
navigate anywhere you want.

The rest of the code in the Selection_Change event could also probably be
placed in the calculate_event, if the values are calculated through
formulas.

HTH,
Bernie
MS Excel MVP
 
Well....it actually scrolls to the point I want it to
be...it lets me bypass extra information and it takes me
exactly to the point of my next entry.

DMP
 
I understand that, but it only scrolls to column 36: why does the code have
the scroll to column 8 - how do you get back to the first column to continue
entering data?

HTH,
Bernie
MS Excel MVP
 
The sheet has a frozen frame and it scrolls far enough to
enclose the data so it helps save time doing data
entry...I dont have to scroll backwards the data fits my
view...

DMP
 
Back
Top