Link to home
Start Free TrialLog in
Avatar of rogerio marinho
rogerio marinho

asked on

Dim rnBody ..... As Range

Hello,

How many declarations of  rnBody i can do in my vba code?
I'm using actualy 23 rnBody in my code, but when he is running stops in the rnBody 15.

Declarations
Dim oWorkSpace12 As Object, oUIDoc As Object
   Dim rnBody, rnBody1, rnBody2, rnBody3 As Range
   Dim rnBody4, rnBody5, rnBody6, rnBody7 As Range
   Dim rnBody8, rnBody9, rnBody10, rnBody11 As Range
   Dim rnBody12, rnBody13, rnBody14, rnBody15 As Range
   Dim rnBody16, rnBody17, rnBody18, rnBody19 As Range
   Dim rnBody20, rnBody21, rnBody22, rnBody23 As Range

........

     Set rnBody12 = ActiveSheet.Range("Sitop_CMC_2")
   rnBody12.Copy
   
   Call oUIDoc.GOTOFIELD("Body")
   Call oUIDoc.Paste
   
   
   
   Set rnBody13 = ActiveSheet.Range("Sitop_CMC_1")
   rnBody13.Copy
   
   Call oUIDoc.GOTOFIELD("Body")
   Call oUIDoc.Paste


Set rnBody14 = Range("Sitop_CMC")
rnBody14.Copy
   
      Call oUIDoc.GOTOFIELD("Body")
   Call oUIDoc.Paste
   
       If [H1].Value > 181 Then
       'MsgBox Range("Sitop_CMC_3")

here is the point

  Set rnBody15 = Range("Sitop_CMC_3")


rnBody15.Copy

      Call oUIDoc.GOTOFIELD("Body")
   Call oUIDoc.Paste
Else
 End If



Please helpe-me if you can.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rogerio marinho
rogerio marinho

ASKER

Great!

This simplify the code.
After the posted question, I found the error on the code.
Was a specific cells with invalid references in the Excel 2013.
Tomorow I'll simplify the code
anyway thanks a lot for help-me.