View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Range(sheet2) = Range(sheet1)

if you want to run the macro from another sheet than sheet1 you have
to
change setting rngSource:


Perhaps...

Sub PostMyInfo()
Dim rngSource As Range, rngTarget As Range
Const sMsg$ = "Select the range to copy values from"

Set rngSource = Application.InputBox(sMsg, Type:=8)
If rngSource Is Nothing Or Not _
WorksheetFunction.CountA(rngSource) = 6 Then Beep: Exit Sub

Set rngTarget = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
With rngSource
rngTarget.Resize(.Rows.Count, .Columns.Count) = .Value
End With
End Sub

...where you can validate the existence/contents of rngSource and
proceed if all is good!

--
Garry

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