Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Cut and Paste #2, vb
Hi,
Last week, Mr. Don Guillett provided me with this formula to cut a Named Range and paste the Named Range one cell/row below. It works perfectly when I run the macro (in another sheet or workbook). However, when I include the two macro commands with other commands, IT DOES NOT WORK the: "Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1)" is highlighted and the program freezes. I tried to use "CutPaste" instead of inserting the two commands but the result is the same. What is wrong? Please help. Sub CutPaste() lr = Application.CountA(Range("thsrng")) 'assumes no blanks Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1) End Sub |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Cut and Paste #2, vb
Thanks again Don. I have the named range. I'm confused because I tried
(included) the two macro commands in other macro commands and it worked perfectly. It is only in this particular SHEET that it won't work! Is it because I have this macro in this sheet? Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Me.Range("$N$2")) Is Nothing Then '(do nothing) Else Run_401k '(run Macro) End If End Sub "Don Guillett" wrote: You did not post the rest of the code. Perhaps you do not have a range named thsrng. As before the presented macro will take the entire thsrng and just move it down one row. It seems to me that MAYBE? it would have been just a good to do an insert. Range("thsrng").Cells(1, 1).Insert Of course this moves things under the range also -- Don Guillett SalesAid Software "Danny" wrote in message ... Hi, Last week, Mr. Don Guillett provided me with this formula to cut a Named Range and paste the Named Range one cell/row below. It works perfectly when I run the macro (in another sheet or workbook). However, when I include the two macro commands with other commands, IT DOES NOT WORK the: "Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1)" is highlighted and the program freezes. I tried to use "CutPaste" instead of inserting the two commands but the result is the same. What is wrong? Please help. Sub CutPaste() lr = Application.CountA(Range("thsrng")) 'assumes no blanks Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1) End Sub |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Cut and Paste #2, vb
Hi,
The macro works on other computers. I'm using Windows Professional XP. I guess this is the reason why! "Danny" wrote: Thanks again Don. I have the named range. I'm confused because I tried (included) the two macro commands in other macro commands and it worked perfectly. It is only in this particular SHEET that it won't work! Is it because I have this macro in this sheet? Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Me.Range("$N$2")) Is Nothing Then '(do nothing) Else Run_401k '(run Macro) End If End Sub "Don Guillett" wrote: You did not post the rest of the code. Perhaps you do not have a range named thsrng. As before the presented macro will take the entire thsrng and just move it down one row. It seems to me that MAYBE? it would have been just a good to do an insert. Range("thsrng").Cells(1, 1).Insert Of course this moves things under the range also -- Don Guillett SalesAid Software "Danny" wrote in message ... Hi, Last week, Mr. Don Guillett provided me with this formula to cut a Named Range and paste the Named Range one cell/row below. It works perfectly when I run the macro (in another sheet or workbook). However, when I include the two macro commands with other commands, IT DOES NOT WORK the: "Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1)" is highlighted and the program freezes. I tried to use "CutPaste" instead of inserting the two commands but the result is the same. What is wrong? Please help. Sub CutPaste() lr = Application.CountA(Range("thsrng")) 'assumes no blanks Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1) End Sub |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Cut and Paste #2, vb
Nope
-- Don Guillett SalesAid Software "Danny" wrote in message ... Hi, The macro works on other computers. I'm using Windows Professional XP. I guess this is the reason why! "Danny" wrote: Thanks again Don. I have the named range. I'm confused because I tried (included) the two macro commands in other macro commands and it worked perfectly. It is only in this particular SHEET that it won't work! Is it because I have this macro in this sheet? Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Me.Range("$N$2")) Is Nothing Then '(do nothing) Else Run_401k '(run Macro) End If End Sub "Don Guillett" wrote: You did not post the rest of the code. Perhaps you do not have a range named thsrng. As before the presented macro will take the entire thsrng and just move it down one row. It seems to me that MAYBE? it would have been just a good to do an insert. Range("thsrng").Cells(1, 1).Insert Of course this moves things under the range also -- Don Guillett SalesAid Software "Danny" wrote in message ... Hi, Last week, Mr. Don Guillett provided me with this formula to cut a Named Range and paste the Named Range one cell/row below. It works perfectly when I run the macro (in another sheet or workbook). However, when I include the two macro commands with other commands, IT DOES NOT WORK the: "Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1)" is highlighted and the program freezes. I tried to use "CutPaste" instead of inserting the two commands but the result is the same. What is wrong? Please help. Sub CutPaste() lr = Application.CountA(Range("thsrng")) 'assumes no blanks Range("thsrng").Cut Destination:=Range("thsrng").Cells(2, 1) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|