View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default DREAM FEATU A macro that moves a row but asks me where to move it

I think I solved my own question. I changed the line to:

rngSource.EntireRow.Delete xlUp


Yes, that's what I would do. Note, though, there is no need to specify
the shift direction since you use the default.

Sorry I wasn't clear on your explanation of the source row issue...

Sub CopySelection()
Dim rngSource As Range, rngTarget As Range, lRow&
Const sPrompt$ = "Select the destination row position"

lRow = Selection.Row
Set rngSource = ActiveSheet.Range("A" & lRow & ":AP" & lRow)
Set rngTarget = Application.InputBox(Prompt:=sPrompt, _
Title:="Move Rows", Type:=8)
If rngTarget Is Nothing Then Exit Sub
With rngTarget.Resize(1, rngSource.Columns.Count)
.Insert: .Offset(-1).Value = rngSource.Value
End With
rngSource.EntireRow.Delete
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com