Can you Help

  • Thread starter Thread starter Frederick
  • Start date Start date
F

Frederick

Thank you for your comment. I will try and explain myself a bit better.
I have a CSV file that has to be put into some order, so I created
sheet in Excel that laid out a format for the page (sheet). While doin
the formatting I ran the Macro recorder which I later put into m
personal.xls. Now not knowing much about excel, I tried to copy 3
lines from the top of the CSV file to show a second CSV file. in th
hope that the macro would pickup the fact there were two files there
However the macro did not pick it up, and only formatted the firs
section.

My aim is to send the client something that they can put into excel.s
when a CSV file comes in to them they can easily lay-out the data on
formatted sheet ready for printing or what ever
 
Frederick

Your posted code shows you formatting the activesheet.

It does not show you copying data from one sheet to another sheet.

to help you further i need to know :-
the name of the workbook the data is to be copied from
the name of the sheet that the data is to be copied from
what rows you need copied
will it always be the same rows that will be copied

what is the name of the workbook that the data will be pasted into
is this a new work book or an existing workbook
what is the name of the sheet that the data is to be pasted into
what is the 1st row that the data is to be pasted into


Also a CSV file does not save sheet formatting. if you want to sav
your formatting you will need to save your file as an Excel workboo
 
Frederick

When recording the macro you used absolute referencing.

The code will have a hard-coded range and will run on that range every time.

To run on a different range you must use relative referencing button when
recording.

Using relative reference you would get

ActiveCell.Range("A1:H30").Select
Selection.Interior.ColorIndex = 6

Which would select 30 rows and 8 columns from wherever the active cell is.

i.e select A1 and the range would run from there.....A1:H30

select A32 and the range would run from there........A32:H62

To find and select the first blank cell below data you would use code like

ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Select

Which selects A31 if A1:A30 contain data.

Start your operations from there.

Also see Help on ActiveCell.


Gord Dibben Excel MVP
 
Back
Top