If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 how can I select a range of cells based on a value of a cell?
 Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

## how can I select a range of cells based on a value of a cell?

#1
June 26th 06, 09:01 AM posted to microsoft.public.excel.misc
 grigoras victor external usenet poster Posts: n/a
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
June 26th 06, 04:55 PM posted to microsoft.public.excel.misc
 thechilipino external usenet poster Posts: n/a
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

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,

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Excel Newsgroups     Excel Discussion (Misc queries)     Setting up and Configuration of Excel     New Users to Excel     Excel Worksheet Functions     Links and Linking in Excel     Charts and Charting in Excel     Excel Programming About ExcelBanter     About this forum

 Similar Threads Thread Thread Starter Forum Replies Last Post Conditional coloring of Excel cells, based on adjacent cell values? Greg Stuart Excel Worksheet Functions 0 March 10th 06 10:14 PM Is there a way to hide worksheets and/or rows/columns based on information enter into a particular cell of range of cells? Marc New Users to Excel 1 March 10th 06 05:10 PM Select Range of Cells programmingrookie Excel Discussion (Misc queries) 2 August 11th 05 07:13 PM How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 9th 05 11:40 PM

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