Fetch unique values from several sheets to one sheet.

Lux Aeterna

Board Regular
Joined
Aug 27, 2015
Messages
205
Office Version
  1. 2019
Platform
  1. Windows
There's an excel workbook that contains several sheets with our yearly workload and I'd like to summarise that data in a new sheet.

Some of the branches we work with remain the same, while some others are added and some others leave.

List of branches are in the List sheets (List2022, List2023 etc) range K5:K38

What I'd like, if possible, is to have a copy of all branches in the Stats sheet column A, so that I can use a vlookup formula to fetch data.

Hope I made my self clear ! 🫣
 
I did not have errors here! Where is the error in the code?

I've been having issues with alternating row shading.

Try deleting this from code to see if the error is addressed:

VBA Code:
'   -----------------------------------
'       Format Transferred Data
'   -----------------------------------

    With rTargetAnchorCell.Resize(iBranch)

        .FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=1"
        .FormatConditions(.FormatConditions.Count).SetFirstPriority

        With .FormatConditions(1).Interior
            .Pattern = xlGray16
            .PatternThemeColor = xlThemeColorDark1
            .ColorIndex = xlAutomatic
            .PatternTintAndShade = -0.349986266670736
        End With

    End With

Do you even care about alternating row shading? If so there is another way to do it.
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
For the future I'd appreciate knowing what line of code causes the error?

Like I said, if you care about alternate row shading I have another way to do it. If you do not care then just delete that part of the code as shown above.
 
Upvote 0
I removed those lines from code and it worked perfectly, thanks a lot! Alternate shading is not necessary.

As for the line of code that caused the problem, I am not sure how to find it, because it didn't offer me the debug option. :)
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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