Sunday, 15 September 2013

excel vba - Application defined or object defined error (named ranges) -


I am stumped with my code on this code, I have to get this general error on the line where it is copied and Paste the selected range after creating the worksheet but it is giving me this disappointing error - I do not know what is going wrong here, please help people, all help was appreciated :) < Pre> Private sub ExpBttn () Dim WrkShtExists as Boolean dim sht worksheet dim Range Dimmer TgtRngB as integer dim TgtRngR range as the dim TgtNme x string select case Multi Case MultiPage1.Value = 0 set TgtRngR = Sheet ("Tracker") range ("U2: Z19") in the form of. Set TgtRngB = Sheet ("Tracker") range. ("U21: Z26") TgtNme = "P4PSoft" Case MultiPage1.Value = 1 Set TgtRngR = Sheet ("Tracker") range. ("AB2: AG19") set TgtRngB = Sheet ("Tracker") range (. "AB21: AG26") TgtNme = "P4PHard" Case MultiPage1.Value = 2 Set TgtRngR = Sheet ("Tracker") range ("AP2 : AU19 ") Set TgtRngB = Sheet (" Tracker "). Ranges (" AP21: AUUU ") TGTN = =" RCI "case multipage 1 Value = 3 set TGRRNGR = Sheet ("Tracker") range ("AI2: AN19"). Set TgtRngB = Sheet ("Tracker") Range ("AI21: AN26"). TgtNme = "RCDI" End Sheets.Add.Name = "Exported_" & amp; Range ("tractor"). Range ("TGTRNGR") Copy destination: = Sheets ("Exported" and "TGTNM)" category ("A1: F18") sheet ("Tracker"). Category ("TGRNNGB") .Copy Destination: = Sheet ("Exported_" & amp; TgtNme) .Range ("A20: F25") Sheet ("Exported_" & TgtNme) .Range ("A1: F18") Sheet ("Tracker") = Range. ("TgtRngR") Value Sheet ("Exported_" & amp; TgtNme) .Range ("A20: F25") = Sheet ("Tracker") Range ("TgtRngB") Value Sheet ("Exported_" & amp; TgtNme). . Choose ActiveSheet.Column ("A: F"). AutoFit

You set your boundaries in the case statement, so copy / paste it Use

  TgtRngR.Copy Destination: = Sheets ("Exported" and "TGTNM"). Range ("A1: F-18")   

and

  Sheets ("Exports" & amp; TgtNme) .Renz ("A1: F18 ") = TgtRngR   

Also, your case statement logic is incorrect. It should be something like

  TgtNme =" "Select Case Multipage 1 If you want to do the TGTNM    

No comments:

Post a Comment