Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default My Data Table


Hello,

I'm looking for a code that will copy data from column B (say B5:B10)
on sheet1, workbook name DataInfo. Then open a workbook named DataTable
on c drive (c:\DataTable), then paste the values on sheet1, starting at
row 4 (say B4:G4 going across). With each click of the button the macro
need to paste down to the next row directly under the first set of
numbers; click again, next row.

I've seen macros that pastes from column to column. I don't know how to
go from one row to the next.

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=470659

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default My Data Table

Maybe like this:

Sub MvData()
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Dim DataBk As Workbook
Dim InfoBk As Workbook
Dim eRow As Long
Set InfoBk = Workbooks("DataInfo.xls")
Set DataBk = Workbooks.Open("C:\DataTable.xls")
eRow = DataBk.Sheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
If eRow < 4 Then
eRow = 4
Else
eRow = eRow + 1
End If
InfoBk.Sheets("Sheet1").Range("B5:B10").Copy
DataBk.Sheets("Sheet1").Cells(eRow, 2).PasteSpecial _
Transpose:=True
Application.CutCopyMode = False
DataBk.Close True
ErrorHandler:
Application.ScreenUpdating = True
End Sub

Hope this helps
Rowan

EMoe wrote:
Hello,

I'm looking for a code that will copy data from column B (say B5:B10)
on sheet1, workbook name DataInfo. Then open a workbook named DataTable
on c drive (c:\DataTable), then paste the values on sheet1, starting at
row 4 (say B4:G4 going across). With each click of the button the macro
need to paste down to the next row directly under the first set of
numbers; click again, next row.

I've seen macros that pastes from column to column. I don't know how to
go from one row to the next.

Thanks,
EMoe


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default My Data Table


Thanks very much,

This code works perfectly.

Regards,
EMo

--
EMo
-----------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...fo&userid=2318
View this thread: http://www.excelforum.com/showthread.php?threadid=47065

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default My Data Table


One more thing. With the code below, I need to do a paste special,
pasting only the values. I tried to add Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, after the pasteSpecial _ but got an error.

Right now the code works well, but it's copying and pasting the
formulas, and not the values

Sub MvData()
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Dim DataBk As Workbook
Dim InfoBk As Workbook
Dim eRow As Long
Set InfoBk = Workbooks("DataInfo.xls")
Set DataBk = Workbooks.Open("C:\DataTable.xls")
eRow = DataBk.Sheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
If eRow < 4 Then
eRow = 4
Else
eRow = eRow + 1
End If
InfoBk.Sheets("Sheet1").Range("B5:B10").Copy
DataBk.Sheets("Sheet1").Cells(eRow, 2).PasteSpecial _
Transpose:=True
Application.CutCopyMode = False
DataBk.Close True
ErrorHandler:
Application.ScreenUpdating = True
End Sub

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=470659

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default My Data Table

Hi Emoe,

DataBk.Sheets("Sheet1").Cells(eRow, 2).PasteSpecial _
Paste:=xlValues, _
Transpose:=True
worked for me.

What error do you get?

---
Regards,
Norman



"EMoe" wrote in message
...

One more thing. With the code below, I need to do a paste special,
pasting only the values. I tried to add Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, after the pasteSpecial _ but got an error.

Right now the code works well, but it's copying and pasting the
formulas, and not the values

Sub MvData()
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Dim DataBk As Workbook
Dim InfoBk As Workbook
Dim eRow As Long
Set InfoBk = Workbooks("DataInfo.xls")
Set DataBk = Workbooks.Open("C:\DataTable.xls")
eRow = DataBk.Sheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
If eRow < 4 Then
eRow = 4
Else
eRow = eRow + 1
End If
InfoBk.Sheets("Sheet1").Range("B5:B10").Copy
DataBk.Sheets("Sheet1").Cells(eRow, 2).PasteSpecial _
Transpose:=True
Application.CutCopyMode = False
DataBk.Close True
ErrorHandler:
Application.ScreenUpdating = True
End Sub

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:
http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=470659





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default My Data Table


Thanks Norman; it works now.

I was doing PasteValues instead of just values like you have it.

Thanks Again,
Emoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=470659

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
How can I detail Pivot Table data without creating a table (Excel2007) Skeletiko[_2_] Excel Discussion (Misc queries) 1 May 5th 10 08:22 AM
How can I detail Pivot Table data without creating a table (Excel2007) Skeletiko Excel Discussion (Misc queries) 0 May 5th 10 12:21 AM
View Pivot Table Source data as a Data Table InsomniacFolder Excel Discussion (Misc queries) 6 April 12th 10 05:17 PM
Lookup data in a variable table & retrieve data from a pivot table Shawna Excel Worksheet Functions 3 October 10th 08 11:11 PM
Excel Pivot Table Plugin? (crosstab to data table) HoMoon115 Excel Discussion (Misc queries) 0 February 22nd 06 08:20 PM


All times are GMT +1. The time now is 10:04 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"