Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy a specific range of cell values into an external workbook

Could someone please help with the following...

I have a worksheet containing a table of information and want to
export only the values of a specific range of cells into an external
workbook. The cells in the table all contain formulas, however i only
want to export those that are not blank (""). I need to export the
cell values each time the table is updated - the number of cells to be
copied will alter each time. This last part doesn't need to be
written into the macro, i would like to run it separately each time
the values are updated.

I have tried the following code, but this simply copies the cell
contents (including formats and formulas) into an external workbook.

Sub Test()
Dim bk As Workbook
Dim bSave As Boolean
Dim lRow As Long

On Error Resume Next
Set bk = Workbooks("File Name.xls")
On Error GoTo 0
If bk Is Nothing Then
bSave = True
Set bk = Workbooks.Open("Path\File Name.xls")
End If

lRow = bk.Worksheets("Sheet1").Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
ThisWorkbook.Sheets("Sheet Name").Range("B1:H170").Copy _
Destination:=bk.Worksheets("Sheet Name").Cells(lRow, 1)

If bSave Then bk.Close Savechanges:=True

End Sub

Can anyone 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
Copy Values to next empty cell range Aldo Cella Excel Worksheet Functions 1 March 10th 08 11:22 PM
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. [email protected] Excel Programming 1 May 13th 07 01:46 PM
copy cell values to another workbook FurRelKT Excel Programming 1 December 1st 06 09:56 PM
External hyperlink to a specific page in a workbook Nimbus55 Excel Worksheet Functions 2 July 31st 06 01:07 PM


All times are GMT +1. The time now is 11:05 PM.

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

About Us

"It's about Microsoft Excel"