Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
how can I select a range of cells based on a value of a cell?
I import an excel table from another application.I want to make a macro to:
1.sort table -it'easy 2.from sorted table to select a range of cells until a value from sorted table is matched.This is the problem. 3.copy selected range in another sheet-it's easy. Thanks, |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
how can I select a range of cells based on a value of a cell?
hello grigoras:
To perform number 2, here is some sample code. (Assuming that the value you want to match is in cell D1, and the values you are comparing against are in Column A, beginning in Row 1.) Sub findmatch() 'sets up row counter Dim c As Integer 'intiate counter c = 1 'beginning of data to look for match Cells(1, 1).Select 'looks for match Do Until Cells(c, 1).Value = Cells(1, 4).Value 'increments counter c = c + 1 Loop 'selects range Range("A1", Cells(c, 1)).Select End Sub I hope that helps. Please post if your question was answered. Cheers. thechilipino. "grigoras victor" wrote: I import an excel table from another application.I want to make a macro to: 1.sort table -it'easy 2.from sorted table to select a range of cells until a value from sorted table is matched.This is the problem. 3.copy selected range in another sheet-it's easy. Thanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional coloring of Excel cells, based on adjacent cell values? | Excel Worksheet Functions | |||
Is there a way to hide worksheets and/or rows/columns based on information enter into a particular cell of range of cells? | New Users to Excel | |||
Select Range of Cells | Excel Discussion (Misc queries) | |||
How can I assign a range starting cell based on a variable locati. | Excel Discussion (Misc queries) | |||
How can I assign a range starting cell based on a variable locati. | Excel Worksheet Functions |