Importing data from Excel worksheet into Excel template

M

Mas

Hi all,

I would like advise on how I can import data from an Excel Worksheet
into an Excel Template.

For example:

Excel Workseet
Column A : Date
Column B : Customer Name
Column C : Code No#
Column D : Weight

Excel Template
Column A : Date
Column B : Year
Column C: Customer Name
Column D : Code No#
Column E : Code Color
Column F : Weight

I would like to import Column A from the Worksheet into Column A of the
template, Column B from the Worksheet to Column C of the template, etc.

How can I set up an macro button to do this for me.

Any help will be greatly appreciated.

Thanks in advance.
 
G

Gord

Turn on the macro recorder whilst doing the steps.

See what you get then post back with more questions.


Gord Dibben Microsoft Excel MVP
 
M

Mas

Hi Gord,

I have created the following macro but cannot get the imported data to
paste into the specified columns.

Can you please tell me what I am doing wrong.

--------------------

Sub ImportData()
'
' Import Data Macro
'

'
Range("C17").Select
Windows("JobsToImport.xls").Activate

Range("A3:A39,B3:B39,C3:C39,D3:D39,E3:E39,F3:F39,G3:G39,H3:H39,I3:I39,J3:J39,L3:L39,N3:N39,O3:O39,P3:p39").Select
Selection.Copy
Windows("JobsImportedData".xls").Activate
Range("C17").Select
Range("D17").Select
Range("E17").Select
Range("F17").Select
Range("G17").Select
Range("H17").Select
Range("I17").Select
Range("K17").Select
Range("L17").Select
Range("N17").Select
Range("O17").Select
Range("Q17").Select
Range("X17").Select
Range("Y17").Select
Range("AB17").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C17").Select


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top