Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Cut and Paste #2, vb


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



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default 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
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



All times are GMT +1. The time now is 05:26 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"