NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,275
- Office Version
- 2016
- 2010
- Platform
- Windows
Good afternoon,
After battering my head all afternoon with various permutations of the below, I'm conceding defeat and throwing myself on the mercy of the Excel Gods
The Names I'm searching on in "StatsSheet" run Horizontally, and in TransSheet they run vertically, so "Totals_SUPBAR_APR" also runs horizontally and "Trans_SUPBAR_APR" runs vertically.
So, I'm looking to transfer AND transpose values based on if the Engineer name matches.
I really need someone to take a look at the way I've qualified the ranges in the "StatsSheet.Cells..." line, as no matter what I do, the values don't transfer correctly
Excel errors out with "Method 'Range' of object'_Global' failed, by the way.
Thanks in advance
Pete
Pete
After battering my head all afternoon with various permutations of the below, I'm conceding defeat and throwing myself on the mercy of the Excel Gods
Code:
Dim StatsSheet As Worksheet
Set StatsSheet = Worksheets("Stats")
Dim TransSheet As Worksheet
Set TransBook = Workbooks.Open(TransBookName)
Set TransSheet = TransBook.Sheets("Table")
For Each MyCell In StatsSheet.Range("BR_Engineers")
For Each MyCell2 In TransSheet.Range("Trans_Engineers")
If Trim(UCase(MyCell2)) = UCase(Trim(MyCell))
StatsSheet.Cells(Range("Totals_SUPBAR_APR").Row, MyCell.Column) = TransSheet.Cells(MyCell2.Row, Range("Trans_SUPBAR_APR").Column)
end if
Next
Next
The Names I'm searching on in "StatsSheet" run Horizontally, and in TransSheet they run vertically, so "Totals_SUPBAR_APR" also runs horizontally and "Trans_SUPBAR_APR" runs vertically.
So, I'm looking to transfer AND transpose values based on if the Engineer name matches.
I really need someone to take a look at the way I've qualified the ranges in the "StatsSheet.Cells..." line, as no matter what I do, the values don't transfer correctly
Excel errors out with "Method 'Range' of object'_Global' failed, by the way.
Thanks in advance
Pete
Pete
Last edited: