Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default PROBLEMS WITH MACROS

If 'External' means another open workbook then try the below

'Change the workbook name as required. Only saved workbook will have the
extension.
Sub Macro()
Dim lngRow As Long, wsDest As Worksheet, rngTemp As Range

Set wsDest = Workbooks("workbookname.xls").Sheets("Sheet2") 'Destination sheet
Set rngTemp = Sheets("Sheet1").Range("A1:A3")
lngRow = wsDest.Cells(Rows.Count, "A").End(xlUp).Row + 1
rngTemp.Copy wsDest.Range("A" & lngRow)

End Sub


If you mean closed workbook; try the below..

Sub Macro()
Dim lngRow As Long, rngTemp As Range
Dim wbBook As Workbook, wsDest As Worksheet

Set rngTemp = ActiveSheet.Range("A1:A3")

Set wbBook = Workbooks.Open("<fullpath\<filename.ext")
Set wsDest = wbBook.Sheets("Sheet1") 'Destination sheet
lngRow = wsDest.Cells(Rows.Count, "A").End(xlUp).Row + 1
rngTemp.Copy wsDest.Range("A" & lngRow)

wbBook.Close True

End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Mike H" wrote:

Neil,

This would copy the selected cells and paste them into the first empty row
in column A of sheet 2

lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
Selection.Copy Destination:=Sheets("Sheet2").Range("A" & lastrow)

Mike

"Neil Holden" wrote:

Hello, I need a macro, when the button is pressed I want a range of cells to
copy and paste into a different excel sheet and always look for the last
blank row so that each time it will automatically insert.

Please help.

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with Macros created in PC run in Mac Nam Excel Programming 1 June 11th 08 06:41 PM
Tracing problems with macros No Name Excel Programming 3 March 6th 06 04:59 PM
problems with macros cjjoo Excel Worksheet Functions 3 September 8th 05 10:00 AM
Problems calling macros in addin from within macros Andibevan[_4_] Excel Programming 2 August 16th 05 09:29 AM
Macros Problems bee Excel Programming 2 December 31st 03 09:54 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"