Results 1 to 3 of 3

Thread: runtime error 9

  1. #1
    4 Star Lounger
    Join Date
    Aug 2005
    Location
    London/Kingston, Surrey, United Kingdom
    Posts
    518
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi all,

    I get the following error ( see the attached screenshot) when I run this macro:

    Code:
    Sub  Macro2()
      Sheets("MASTER").Select
      For homes = 1 To 170
    	ActiveSheet.Next.Select
    	Range("A1").Select
    	COSTCENTRE = ActiveCell
    	RO1 =  8
    	For ro = 2 To 1035
    	  Sheets("MASTER").Select
    	  Range("A" & ro).Select
    	  If ActiveCell = COSTCENTRE Then
    		Rows(ro).Select
    		Selection.Copy
    		Sheets(COSTCENTRE).Select
    		Rows(RO1).Select
    		Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    		:=False,  Transpose:=False
    		Application.CutCopyMode = False
    		RO1 = RO1 + 1
    	  End If
    	Next ro
    	Sheets(COSTCENTRE).Select
      Next homes
    End Sub
    your help is much appreciated
    Attached Images Attached Images

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Where does the error occur? It probably means that you tried to select a non-existing worksheet.

  3. #3
    4 Star Lounger
    Join Date
    Aug 2005
    Location
    London/Kingston, Surrey, United Kingdom
    Posts
    518
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='794871' date='25-Sep-2009 14:41']Where does the error occur? It probably means that you tried to select a non-existing worksheet.[/quote]

    IT has been sorted the master sheet was moved before a vlookup worksheet where there is a formula....so by moving the sheet in order with the other sheet fixed the problem.

    many thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •