ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   impossible to change the activecell??? (https://www.excelbanter.com/excel-programming/282013-impossible-change-activecell.html)

John T Ingato

impossible to change the activecell???
 
I have a function which analyzes the active cell, offsets it by one, and
loops this way until it find an empty cell. Its my version of finding the
end of a contiguous range. It work well in almost every condition, but it
appears that when it is called from a particular function, the activecell
cannot be offset.

The calling code does nothing more then call the function, just like any
other function

Does anyone know of a condition where the activecell is locked?


THIS IS THE CALLING FUNCTION
Private Sub ListOfRepsBox_Click()

UpdateStores

If Me.MultiPage1.Value = 1 Then Me.StoreEntry.SetFocus

End Sub


THIS IS THE LOOP
ElseIf Selection = "col" Then

Do While Not IsEmpty(ActiveCell)

ActiveCell.Offset(NextCell, 0).Select
Count = Count + 1

Loop

If Count 1 Then ActiveCell.Offset(-1, 0).Select

End If



Nikos Yannacopoulos[_4_]

impossible to change the activecell???
 
Finding the end of a continuous renage is a hell of a lot
easier and faster by using:

Selection.End(xlToRight).Select
or xlTo Left, xlUp, xlDown...

Give it a shot.

Nikos Y. (nyannaco at in dot gr)
-----Original Message-----
I have a function which analyzes the active cell,

offsets it by one, and
loops this way until it find an empty cell. Its my

version of finding the
end of a contiguous range. It work well in almost every

condition, but it
appears that when it is called from a particular

function, the activecell
cannot be offset.

The calling code does nothing more then call the

function, just like any
other function

Does anyone know of a condition where the activecell is

locked?


THIS IS THE CALLING FUNCTION
Private Sub ListOfRepsBox_Click()

UpdateStores

If Me.MultiPage1.Value = 1 Then Me.StoreEntry.SetFocus

End Sub


THIS IS THE LOOP
ElseIf Selection = "col" Then

Do While Not IsEmpty(ActiveCell)

ActiveCell.Offset(NextCell, 0).Select
Count = Count + 1

Loop

If Count 1 Then ActiveCell.Offset(-1,

0).Select

End If


.



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com