View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
-[::::Shamran::::]- -[::::Shamran::::]- is offline
external usenet poster
 
Posts: 22
Default error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error

Just been looking at it agant ... what a mess .. I'll just have another
look..don't be using any time on this..Let me cleare it up first ??


regards, Shamran

"-[::::Shamran::::]-" wrote in message
...
Strange ... I don't think that I am going off the Sheet :

The full code looks like this :

Sub Fedtprocent()

Sheets("data").Select
Range("O2").Select
ActiveCell.Offset(0, -11).Select 'Flytter aktivcelle til køn

For a = 1 To 6000

If ActiveCell = "F" Then 'Sortering for kvinder og 20-39 år

ActiveCell.Offset(0, -1).Select ' Flyt activ celle til alder

If ActiveCell = 20 And ActiveCell = 39 Then

ActiveCell.Offset(0, 12).Select ' Flyt activ celle til fedtprocent

If ActiveCell < 21 Then
myCount = Sheets("Fedtprocent").Range("C12") + 1
Sheets("Fedtprocent").Range("C12") = myCount
End If

If ActiveCell = 21 And ActiveCell < 33 Then
myCount = Sheets("Fedtprocent").Range("C13") + 1
Sheets("Fedtprocent").Range("C13") = myCount
End If

If ActiveCell = 33 And ActiveCell < 39 Then
myCount = Sheets("Fedtprocent").Range("C14") + 1
Sheets("Fedtprocent").Range("C14") = myCount
End If

If ActiveCell = 39 Then
myCount = Sheets("Fedtprocent").Range("C15") + 1
Sheets("Fedtprocent").Range("C15") = myCount
End If

End If

End If


If ActiveCell.Value = "" Then 'End macro ved tom celle
Sheets("Fedtprocent").Select
Range("L2").Select
Application.ScreenUpdating = True
End
End If

ActiveCell.Offset(1, -11).Select ' Flyt celle ned. Fedtprocent celle er
valgt

Next a

End Sub