Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default select a different range each time

more info would help.

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"Joy Chen" wrote in message
...
Hi,

I like to write a micro that will select a range of cells
based on a starting point/cell that I assign each time
and perform repetitive data sorting for me from there.
Any help would be appreciated. Thank you.

Joy



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default select a different range each time

I have segments of data in my spreadsheet that contain similar
information and require to be organized in the similar fashion. It
would be nice if I can write a macro so that each time I can sort a
fixed size of range starting at the beginning of each segment. Thank
you.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default select a different range each time

The way that works for me, which may not be the BEST way is: For the other
ranges I want to loop through, I select the starting cell of the following
ranges, in code, one at a time: Example Range("A1").select. This would then
make it the active cell . I would then loop down the range and perform
whatever action I wanted.....
"Joy Chen" wrote in message
...
I have segments of data in my spreadsheet that contain similar
information and require to be organized in the similar fashion. It
would be nice if I can write a macro so that each time I can sort a
fixed size of range starting at the beginning of each segment. Thank
you.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default select a different range each time

that is what was suggested - but I believe the poster was assuming you would
process the whole sheet.

If you want to designate the range to work on by selecting it, then you can
make your macro use references like

ActiveCell

Selection and so forth.

then you wouldn't have to change anything in the code.

Regards,
Tom Ogilvy


Joy Chen wrote in message
...
Do you mean going into the micro each time and manually change the
select cell, e.g. "A1", to the disired new location?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default select a different range each time

or you could....
Have your macro select the first cell of each range, one at a time and after
each swelection, run the following:
Ex: Range("E5").select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop

The row of cells under E5, like e6,e7,e8 would be selected one a t a time
and then some action performed......

after this, have the macro select the first cell of the NEXT range.....and
follow the same code


"Tom Ogilvy" wrote in message
...
Turn on the macro recorder (tools=Macro=Record a new macro)
Select the upper left corner of one of the ranges,
Then do Data=sort

the turn off the macro recorder

Adapt the macro to do any additional processing you require.

Regards,
Tom Ogilvy


Joy Chen wrote in message
...
I have segments of data in my spreadsheet that contain similar
information and require to be organized in the similar fashion. It
would be nice if I can write a macro so that each time I can sort a
fixed size of range starting at the beginning of each segment. Thank
you.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default select a different range each time

I forgot to add: Before your Loop statement, place your code to perform
whatever action you want
Ex:Ex: Range("E5").select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
'Perform some action

Loop
Works like a charm for me ewverytime

"ibeetb" wrote in message
...
or you could....
Have your macro select the first cell of each range, one at a time and

after
each swelection, run the following:
Ex: Range("E5").select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop

The row of cells under E5, like e6,e7,e8 would be selected one a t a time
and then some action performed......

after this, have the macro select the first cell of the NEXT range.....and
follow the same code


"Tom Ogilvy" wrote in message
...
Turn on the macro recorder (tools=Macro=Record a new macro)
Select the upper left corner of one of the ranges,
Then do Data=sort

the turn off the macro recorder

Adapt the macro to do any additional processing you require.

Regards,
Tom Ogilvy


Joy Chen wrote in message
...
I have segments of data in my spreadsheet that contain similar
information and require to be organized in the similar fashion. It
would be nice if I can write a macro so that each time I can sort a
fixed size of range starting at the beginning of each segment. Thank
you.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default select a different range each time

Thanks for previous reply and help!

I now would like to design a micro to paste 3 consecutive cells based on
a word found in the first of the cells.

I figure I can use the Find function (Ctrl+F) on a spreadsheet to find
the word. How then could I select the cell that contains the word and
copy the cells and the two cells next to it.

I know I should put the Find function and related detail in a loop.
Here is what I have so far. Could you check for me and help me to
program the rest.

Sheets("MET23").Select
Range("A2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Sheets("").Select
Cells.Find(What:="MET", After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
).Activate
Cells.FindNext(After:=ActiveCell).Activate

Range(????).Select
Selection.Copy
Sheets("MET32").Select

Loop

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Run-Time error '1004' : Select method of Range class failed [email protected] Excel Discussion (Misc queries) 3 March 9th 07 01:36 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Trying to select a specific range based on the time value of user form input Jitranijam New Users to Excel 8 November 15th 06 12:52 AM


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"