• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

Loop through range VBA

I am trying to use a VBA from one workbook to another.  When i run my vba it looks like my rngcell is = to nothing i need it to be the BU_Range from the BU INFO  sheet.
Can somone help me with this.  THe GXA is a global add on to Excel and should be ignored.  
Thanks




Sub Update_Distribute_For_All_CBC_BU  ()
 
Dim rngCell As Range
 
Application.ScreenUpdating = False
 
For Each rngCell In Range("BU_RANGE")

    Range("SRF-13 Branch Income Statement Act+Bud.xlsx]Options'!$B$4") = rngCell '// change to your input cell //

                                                     
            ' Add this macro to the active workbook to call Spreadsheet Server's clear cache and recalc.
                           
             Call Application.Run("ClearAndRecalc")
                               
             'To the active workbook to call Distribution Manager's Distribute function.
             'Distributes open file to location specified in (Options) sheet

             Call Application.Run("DistributeAll_DAS")
             
Next rngCell
 
End Sub
Update-and-distribute-to-all-CBG.xlsm
SRF-13-Branch-Income-Statement-A.xlsx
0
Jenedge73
Asked:
Jenedge73
1 Solution
 
SteveCommented:
It may help to specify the workbook and worksheet holding the range.
then to check the rngCell use the debug,print to view in the imediate window.

Dim wb as workbook
Dim ws as worksheet
Dim rngCell As Range
Set wb = ThisWorkbook
set ws = wb.sheets("<insert worksheet name>")

Application.ScreenUpdating = False
 
For Each rngCell In ws.Range("BU_RANGE")
Debug.Print rngCell.address

Open in new window

0
 
NorieData ProcessorCommented:
Deleted - Misread post.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now