ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Corresponding Range in another column (https://www.excelbanter.com/excel-programming/373068-corresponding-range-another-column.html)

achidsey[_2_]

Corresponding Range in another column
 
Excel Experts,

My spreadsheet is similar to the following:

A B C D
1 Trader Action Quantity Fees
2 Bill 20
3 Bill 20
4 Steve 30
5 Steve 30

I've defined cells A2..A5 as a variable Trades
I've defined cell D1 as a variable Fees
How do I select the range D2..D5, that is, the same cells
as in Trades, but in the column where Fees is?

My code so far:

Sub Fees()

Cells.Find(What:="TraderID").Offset(1).Select
Range(Selection, Selection.End(xlDown)).Select
Set Trades = Selection

Set Fees = Cells.Find(What:="Fees")


End Sub

Thank you,
Alan

Don Guillett

Corresponding Range in another column
 
something like this. untested

mc=rows(1).find("Fees").column
lr=cells(rows.count,mc).end(xlup).row
set fees=range(cells(2,mc),cells(lr,mc))


--
Don Guillett
SalesAid Software

"achidsey" wrote in message
...
Excel Experts,

My spreadsheet is similar to the following:

A B C D
1 Trader Action Quantity Fees
2 Bill 20
3 Bill 20
4 Steve 30
5 Steve 30

I've defined cells A2..A5 as a variable Trades
I've defined cell D1 as a variable Fees
How do I select the range D2..D5, that is, the same cells
as in Trades, but in the column where Fees is?

My code so far:

Sub Fees()

Cells.Find(What:="TraderID").Offset(1).Select
Range(Selection, Selection.End(xlDown)).Select
Set Trades = Selection

Set Fees = Cells.Find(What:="Fees")


End Sub

Thank you,
Alan





All times are GMT +1. The time now is 07:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com