Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default non continous cells

Hi...

I have a sheet with two types of inputs from the user...

its either a "Y" or a number...

the cells are not all side by side or top to botom...

I would like to take all the letter cells and make them into a range... give
it a name and then on a specific keystrike (alt-Q or something) have a macro
change only the named range cell..

right now Im using the create macro tool and everytime I add something I
have to add more stuff to the macro...

looking for an easier way to do this....

any suggestions
--
Thanks JT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default non continous cells

Here is some code to create the named range. It looks through the entire
sheet for cells taht are "Y" and makes a named range (YCells) with them...
Not too sure what you want after this...

Sub FindYCell()
Dim rngFound As Range
Dim rngFoundall As Range
Dim rngToSearch As Range
Dim strFirstAddress As String

Set rngToSearch = ActiveSheet.Cells
Set rngFound = rngToSearch.Find(What:="Y", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If Not rngFound Is Nothing Then
Set rngFoundall = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundall = Union(rngFound, rngFoundall)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
ActiveSheet.Names.Add "YCells", rngFoundall
End If
End Sub

--
HTH...

Jim Thomlinson


"JT" wrote:

Hi...

I have a sheet with two types of inputs from the user...

its either a "Y" or a number...

the cells are not all side by side or top to botom...

I would like to take all the letter cells and make them into a range... give
it a name and then on a specific keystrike (alt-Q or something) have a macro
change only the named range cell..

right now Im using the create macro tool and everytime I add something I
have to add more stuff to the macro...

looking for an easier way to do this....

any suggestions
--
Thanks JT

  #3   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default non continous cells

Thanks... seems to be working great....
--
Thanks JT


"Jim Thomlinson" wrote:

Here is some code to create the named range. It looks through the entire
sheet for cells taht are "Y" and makes a named range (YCells) with them...
Not too sure what you want after this...

Sub FindYCell()
Dim rngFound As Range
Dim rngFoundall As Range
Dim rngToSearch As Range
Dim strFirstAddress As String

Set rngToSearch = ActiveSheet.Cells
Set rngFound = rngToSearch.Find(What:="Y", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If Not rngFound Is Nothing Then
Set rngFoundall = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundall = Union(rngFound, rngFoundall)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
ActiveSheet.Names.Add "YCells", rngFoundall
End If
End Sub

--
HTH...

Jim Thomlinson


"JT" wrote:

Hi...

I have a sheet with two types of inputs from the user...

its either a "Y" or a number...

the cells are not all side by side or top to botom...

I would like to take all the letter cells and make them into a range... give
it a name and then on a specific keystrike (alt-Q or something) have a macro
change only the named range cell..

right now Im using the create macro tool and everytime I add something I
have to add more stuff to the macro...

looking for an easier way to do this....

any suggestions
--
Thanks JT

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
SUMPRODUCT NON-CONTINOUS CELL Harsh Bahal Excel Worksheet Functions 2 March 3rd 09 09:39 AM
Continous number box Egypt709 Excel Discussion (Misc queries) 1 January 23rd 09 11:05 PM
Sum of continous cell Man Excel Worksheet Functions 3 July 14th 08 05:45 PM
Print row labels that are continous Luke Excel Discussion (Misc queries) 1 November 23rd 07 01:37 PM
Code does a continous loop L. Howard Kittle Excel Programming 4 August 9th 05 06:53 AM


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

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"