View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default activecell.offset does not work

Hi
first: no need for using select statements in such a case.
Second: Could you explain what you want to achieve with this?

Maybe try:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim AllCells As Range
Dim rng As Range

with Sheets("Factuur")
rijnummer = 21
Do While Not IsEmpty(.cells(rijnummer,1).value)
If IsNumeric(.cells(rijnummer,1).value) Then
rijnummer = rijnummer + 1
End If
Loop
end with

--
Regards
Frank Kabel
Frankfurt, Germany

"hans" schrieb im Newsbeitrag
...
I am using this function

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim AllCells As Range
Dim rng As Range
Sheets("Factuur").Select
Range("a21").Select
rijnummer = ActiveCell.Row
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(0, 1).Select

If IsNumeric(ActiveCell.Value) Then
rijnummer = ActiveCell.Row + 1
End If
Loop

I have no clue but nor rage("a21") nor activecell.offset seems to

work.

Has anyone a idear what i am doin wrong?

Thanks Hans