PC Review


Reply
Thread Tools Rate Thread

Cycle through A Range

 
 
jutlaux
Guest
Posts: n/a
 
      6th Jan 2009
What I am trying to do is have a user select a range of cells and then what I
would like to do is cycle through just these cells.

This is basically like if I where on a worksheet and selected a range of
cells and hit the enter key.

Thanks.
 
Reply With Quote
 
 
 
 
jutlaux
Guest
Posts: n/a
 
      6th Jan 2009
Looks through the selected cells (not the entire work sheet) for a specific
phrase

If it finds the phrase in the cell then
1) Capitalize just the phrase
2) Marks the cells that have the phrase with a red back color
3) Copy's the cells that have the phrase to another work sheet
4) Move to next cell

Currently the user selects the range and then does a find for the phrase and
then manually does everything above.

I know how to do all the steps if the user where just selecting one cell,
but ran into a problem on the multiple cells as I can't figure out how to
find out which cells the user selected and then move through them.

It should also be noted that the user could select cells with the Ctrl
button so "range" might not be all together.

"royUK" wrote:

>
> What's the end use of the code?
>
>
> --
> royUK
>
> Hope that helps, RoyUK
> For tips & examples visit my 'web site' (http://www.excel-it.com/)
> ------------------------------------------------------------------------
> royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
> View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=47032
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Jan 2009
Dim myRng as range
dim myCell as range

set myrng = selection
for each mycell in myrng.cells
if lcase(mycell.value) = lcase("yourexactphrasehere") then
'do the work
end if
next mycell

This looks for cells that match the phrase you want--not just contains the
phrase.

if lcase(mycell.value) like "*" & lcase("yourphrasehere") & "*" then

might be what you want.

jutlaux wrote:
>
> Looks through the selected cells (not the entire work sheet) for a specific
> phrase
>
> If it finds the phrase in the cell then
> 1) Capitalize just the phrase
> 2) Marks the cells that have the phrase with a red back color
> 3) Copy's the cells that have the phrase to another work sheet
> 4) Move to next cell
>
> Currently the user selects the range and then does a find for the phrase and
> then manually does everything above.
>
> I know how to do all the steps if the user where just selecting one cell,
> but ran into a problem on the multiple cells as I can't figure out how to
> find out which cells the user selected and then move through them.
>
> It should also be noted that the user could select cells with the Ctrl
> button so "range" might not be all together.
>
> "royUK" wrote:
>
> >
> > What's the end use of the code?
> >
> >
> > --
> > royUK
> >
> > Hope that helps, RoyUK
> > For tips & examples visit my 'web site' (http://www.excel-it.com/)
> > ------------------------------------------------------------------------
> > royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
> > View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=47032
> >
> >


--

Dave Peterson
 
Reply With Quote
 
jutlaux
Guest
Posts: n/a
 
      6th Jan 2009
Works great.

Thanks!

"Dave Peterson" wrote:

> Dim myRng as range
> dim myCell as range
>
> set myrng = selection
> for each mycell in myrng.cells
> if lcase(mycell.value) = lcase("yourexactphrasehere") then
> 'do the work
> end if
> next mycell
>
> This looks for cells that match the phrase you want--not just contains the
> phrase.
>
> if lcase(mycell.value) like "*" & lcase("yourphrasehere") & "*" then
>
> might be what you want.
>
> jutlaux wrote:
> >
> > Looks through the selected cells (not the entire work sheet) for a specific
> > phrase
> >
> > If it finds the phrase in the cell then
> > 1) Capitalize just the phrase
> > 2) Marks the cells that have the phrase with a red back color
> > 3) Copy's the cells that have the phrase to another work sheet
> > 4) Move to next cell
> >
> > Currently the user selects the range and then does a find for the phrase and
> > then manually does everything above.
> >
> > I know how to do all the steps if the user where just selecting one cell,
> > but ran into a problem on the multiple cells as I can't figure out how to
> > find out which cells the user selected and then move through them.
> >
> > It should also be noted that the user could select cells with the Ctrl
> > button so "range" might not be all together.
> >
> > "royUK" wrote:
> >
> > >
> > > What's the end use of the code?
> > >
> > >
> > > --
> > > royUK
> > >
> > > Hope that helps, RoyUK
> > > For tips & examples visit my 'web site' (http://www.excel-it.com/)
> > > ------------------------------------------------------------------------
> > > royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
> > > View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=47032
> > >
> > >

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Microsoft Excel Charting 1 17th Dec 2009 03:03 AM
Cycle Jeff Boyce Microsoft Access Form Coding 3 29th Jan 2008 02:20 PM
cycle time out of range error Access lightweight Microsoft Excel Misc 1 15th Jan 2008 04:58 PM
How do I keep result from 1 iteration cycle to use in next cycle? =?Utf-8?B?c2dsOGFrbQ==?= Microsoft Excel Misc 0 27th Jul 2006 08:28 PM
Re-cycle Bin anthony_mct@hotmail.com Microsoft Windows 2000 4 26th Mar 2004 10:59 PM


Features
 

Advertising
 

Newsgroups
 


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