LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Create Named Ranges (Headers) - then using range name in formu

That's basically what I tried the first time I ran it, but I forgot to put
in the last "range" command before ("Red").column).
Still get the stupid Global' error for some reason. I eventually intended
to run it the way you show without range names. Thanks.


"Dave Peterson" wrote:

You're using Red as a range name, too?

with activesheet 'I like to qualify my ranges
.Range(.Cells(i, "CC"), .Cells(i, "CD")).Cut _
Destination:=.Cells(i, .range("Red").column)
end with

=========
You could be able to do this without using range names.

Dim FoundCell as range
with activesheet
with .rows(1) 'those headers are in row 1???
set foundcell = .cells.find(What:="red", _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlwhole, _
SearchOrder:=xlBycolumns, _
SearchDirection:=xlNext, _
MatchCase:=False)
end with

if foundcell is nothing then
'what should happen
exit sub '??? with a msgbox???
end if

.Range(.Cells(i, "CC"), .Cells(i, "CD")).Cut _
Destination:=.Cells(i, foundcell.column)

end with

ManhattanRebel wrote:

In a macro, I am selecting ten columns and creating range names based on the
top row.

Then I cut cells from another column and paste it to the appropriate column
by range name.

For example, I find the word "red" in cell D95. I want to paste that word,
and the cell next to it, in the column with the range name "red" in the same
row, 95. (I just want to move it over so it's in the column with the same
name.)

If I use the following code, I get an error:
Range(Cells(i, "CC"), Cells(i, "CD")).Cut Destination:=Cells(i, "Red")

Is there a way for me to specify that "Red" is only the column part of the
cell address?

Thank you.


--

Dave Peterson

 
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
Headers/Footers from a named range of cells in a worksheet RMort Excel Discussion (Misc queries) 3 September 19th 08 08:35 PM
Create list of Named Ranges Jim Tibbetts Excel Worksheet Functions 4 February 15th 07 05:29 PM
Create named ranges loopoo[_25_] Excel Programming 2 December 22nd 05 01:16 PM
Using a formula to create named range reference [email protected] Excel Worksheet Functions 4 June 29th 05 08:03 PM
Using VB to to create named ranges PC[_3_] Excel Programming 7 May 19th 05 10:57 AM


All times are GMT +1. The time now is 06:59 AM.

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

About Us

"It's about Microsoft Excel"