Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cameron Evans   on Aug 18 In MS Office Category.

  
Question Answered By: Roosevelt Jenkins   on Aug 18

Here is a macro just for you. Have both workbooks open. Paste the following code
into a VBA module in either of the 2 workbooks. Edit the constants near the top
of the code, to make sure the workbook  names, sheet names, and starting cell
addresses are correct in each workbook. You can run the macro from either
workbook (Tools >> Macro >> Macros, select CopyStuff, click Run).

Public Sub CopyStuff()
Dim CurrRow As Long, ToCol As Integer
Const FromWB = "Lists_Etc.xls" 'source workbook
Const FromSht = "Sheet1" 'source sheet
Const FromCell = "B1" 'first cell of source data
Const ToWB = "4 Week Data.xls" 'destination workbook
Const ToSht = "Sheet1" 'destination sheet
Const ToCell = "C5" 'where FromCell should go

CurrRow& = Range(ToCell).Row
ToCol% = Range(ToCell).Column
Application.Workbooks(FromWB).Activate
Sheets(FromSht).Activate
Range(FromCell).Activate
Do While Len(ActiveCell.Value) > 0
Application.Workbooks(ToWB).Sheets(ToSht).Cells(CurrRow&, ToCol%).Value
= ActiveCell.Value
CurrRow& = CurrRow& + 9
ActiveCell.Offset(1, 0).Activate
Loop
End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Copy past issue Or get search suggestion and latest updates.


Tagged: