Cut and Paste #2, vb

G

Guest

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
 
D

Don Guillett

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
 
G

Guest

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
 
G

Guest

Hi,

The macro works on other computers. I'm using Windows Professional XP. I
guess this is the reason why!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top