Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Headers/Footers from a named range of cells in a worksheet | Excel Discussion (Misc queries) | |||
Create list of Named Ranges | Excel Worksheet Functions | |||
Create named ranges | Excel Programming | |||
Using a formula to create named range reference | Excel Worksheet Functions | |||
Using VB to to create named ranges | Excel Programming |