Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 163
Default Coding issue with Excel 2003

Hi all Gurus, below is code to transfer data from sheet 1 and 2 into an
external sheet. I want to have a button so that when pressed it transfers a
range of cells from sheet 1 and 2 and places it in the first available row in
the external sheet, all the information needs to go into sheet 1 of the
external sheet.

Please help, i would greatly appreciate it.

Neil.

Dim lngRow As Long, rngTemp As Range
Dim wbBook As Workbook, wsDest As Worksheet
Dim wb1 As Workbook, wb2 As Workbook

Application.DisplayAlerts = False
Application.ScreenUpdating = False

Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open("\\sguk-app1\Business Objects\Expenses\test
data.xls")
wb1.Sheets("Sheet1").Range("A21:S81").Copy
wb2.Sheets("Sheet1").Range("A21:S81")
wb1.Sheets("Sheet2").Range("A21:S81").Copy
wb2.Sheets("Sheet2").Range("A21:S81")
wb2.Close True
Application.DisplayAlerts = True
Application.ScreenUpdating = True

Set wbBook = Workbooks.Open("\\sguk-app1\Business Objects\Expenses\test
data.xls")
Set wsDest = wbBook.Sheets("Sheet1") 'Destination sheet

With rngTemp
lngRow = wsDest.Cells(Rows.Count, "A").End(xlUp).Row + 1

wsDest.Range("A" & lngRow).Resize(rngTemp.Rows.Count, _
rngTemp.Columns.Count) = rngTemp.Value

End With

wbBook.Close True
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Coding issue with Excel 2003

Where do you set rngTemp? I see where you are trying to set the values in the
external sheet to rngTemp values but you never specify what rngTemp is.
--
HTH...

Jim Thomlinson


"Neil Holden" wrote:

Hi all Gurus, below is code to transfer data from sheet 1 and 2 into an
external sheet. I want to have a button so that when pressed it transfers a
range of cells from sheet 1 and 2 and places it in the first available row in
the external sheet, all the information needs to go into sheet 1 of the
external sheet.

Please help, i would greatly appreciate it.

Neil.

Dim lngRow As Long, rngTemp As Range
Dim wbBook As Workbook, wsDest As Worksheet
Dim wb1 As Workbook, wb2 As Workbook

Application.DisplayAlerts = False
Application.ScreenUpdating = False

Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open("\\sguk-app1\Business Objects\Expenses\test
data.xls")
wb1.Sheets("Sheet1").Range("A21:S81").Copy
wb2.Sheets("Sheet1").Range("A21:S81")
wb1.Sheets("Sheet2").Range("A21:S81").Copy
wb2.Sheets("Sheet2").Range("A21:S81")
wb2.Close True
Application.DisplayAlerts = True
Application.ScreenUpdating = True

Set wbBook = Workbooks.Open("\\sguk-app1\Business Objects\Expenses\test
data.xls")
Set wsDest = wbBook.Sheets("Sheet1") 'Destination sheet

With rngTemp
lngRow = wsDest.Cells(Rows.Count, "A").End(xlUp).Row + 1

wsDest.Range("A" & lngRow).Resize(rngTemp.Rows.Count, _
rngTemp.Columns.Count) = rngTemp.Value

End With

wbBook.Close True

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
Excel 2003 VB CODING Neil Holden Excel Discussion (Misc queries) 2 February 17th 10 11:15 AM
Excel 2003 coding issue Neil Holden Excel Discussion (Misc queries) 0 February 16th 10 09:18 AM
Please please help!! Weird coding issue Neil Holden Excel Discussion (Misc queries) 1 February 12th 10 03:48 PM
excel 2003 issue jgb1270 Excel Worksheet Functions 0 March 18th 09 03:34 PM
Excel VBA coding - Outlook and Shut down issue [email protected] Excel Worksheet Functions 0 October 1st 06 06:29 PM


All times are GMT +1. The time now is 08:12 PM.

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"