Working with a VBA array

Jvalades

New Member
Joined
Jul 28, 2016
Messages
40
So I will do my best to write this out.

Currently, I have a VBA loop that filters a range of cells looking for a color and then stores that cell reference. After that, I loop backward through the array inserting a row above it.

Code:
For i = UBound(visibleRowNumbers) To 0 Step -1            .Rows(visibleRowNumbers(i)).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromRightOrBelow 'xlFormatFromLeftOrAbove
                
        Next

I now I need to add into the loop a math equation which will locate column Q in Rows(visibleRowNumbers(i)). Insert the equation Roundup(Cells((i),"Q").offset(-1,)/Sum(Q(i).offset(-2,1):Q(i).offset(-1,5))/6),2)

I know this is improper syntax but I am a novice VBA programmer at best so this is how I am trying to explain it.

Let me also try to explain this verbally in hopes for an outcome.

As I loop backward through the array I also use that stored row value to move out to column Q and add this formula "Roundup(Q34/Sum(R35:W36)/6),2)". I will then copy this formula horizontally all the way to column AQ. Remember.. In the equation above I am going to be using (i) as the row number but the column labels are accurate.

Any advice or help would be greatly appreciated.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top