Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ann
 
Posts: n/a
Default Macro Help for a Novice

Firstly, I am a novice and therefore any instructions need to be idiot proof.

I have several spreadsheets that I receive daily.

I seem to do the same routines on a daily basis and was therefore wondering
if it can be automated.

This is what I do on a daily basis: -

Open them;

Position on the second column and depress END and down arrow (to get me to
the last row);

Retype the value that is currently in that cell (i.e. if it say 578, I just
retype it) and change the format of the cell from a date format (dd/mm/yy) to
a general number. The reason I retype the value is that there is a formula in
the cell;

I then manually delete all the rows except the first and the last rows.

I have tried to record a macro but it inserts a cell references and
unfortunately this doesnt work as the range to be deleted changes on a daily
basis.

Can the above task(s) be automated so that I just run a macro?


Any help offered would me appreciated.

--
Thanks

Ann
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Add this to a standard code module.

Got to the VB IDE - ALt-F11
Insert a code module - InsertModule
Paste this code

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub


--
HTH

Bob Phillips

"Ann" wrote in message
...
Firstly, I am a novice and therefore any instructions need to be idiot

proof.

I have several spreadsheets that I receive daily.

I seem to do the same routines on a daily basis and was therefore

wondering
if it can be automated.

This is what I do on a daily basis: -

Open them;

Position on the second column and depress END and down arrow (to get me to
the last row);

Retype the value that is currently in that cell (i.e. if it say 578, I

just
retype it) and change the format of the cell from a date format (dd/mm/yy)

to
a general number. The reason I retype the value is that there is a formula

in
the cell;

I then manually delete all the rows except the first and the last rows.

I have tried to record a macro but it inserts a cell references and
unfortunately this doesn't work as the range to be deleted changes on a

daily
basis.

Can the above task(s) be automated so that I just run a macro?


Any help offered would me appreciated.

--
Thanks

Ann



  #3   Report Post  
Ann
 
Posts: n/a
Default

Bob,

Thanks for the simple instruction.

The macro deletes the rows as requested, however, the value is blanked out
(i.e. last rows cell B.

Any ideas why this is happening?

Thanks
--
Thanks

Ann


"Bob Phillips" wrote:

Add this to a standard code module.

Got to the VB IDE - ALt-F11
Insert a code module - InsertModule
Paste this code

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub


--
HTH

Bob Phillips

"Ann" wrote in message
...
Firstly, I am a novice and therefore any instructions need to be idiot

proof.

I have several spreadsheets that I receive daily.

I seem to do the same routines on a daily basis and was therefore

wondering
if it can be automated.

This is what I do on a daily basis: -

Open them;

Position on the second column and depress END and down arrow (to get me to
the last row);

Retype the value that is currently in that cell (i.e. if it say 578, I

just
retype it) and change the format of the cell from a date format (dd/mm/yy)

to
a general number. The reason I retype the value is that there is a formula

in
the cell;

I then manually delete all the rows except the first and the last rows.

I have tried to record a macro but it inserts a cell references and
unfortunately this doesn't work as the range to be deleted changes on a

daily
basis.

Can the above task(s) be automated so that I just run a macro?


Any help offered would me appreciated.

--
Thanks

Ann




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Sorry, I dropped a dot. Try this

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = .Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub

--
HTH

Bob Phillips

"Ann" wrote in message
...
Bob,

Thanks for the simple instruction.

The macro deletes the rows as requested, however, the value is blanked out
(i.e. last rows cell B.

Any ideas why this is happening?

Thanks
--
Thanks

Ann


"Bob Phillips" wrote:

Add this to a standard code module.

Got to the VB IDE - ALt-F11
Insert a code module - InsertModule
Paste this code

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub


--
HTH

Bob Phillips

"Ann" wrote in message
...
Firstly, I am a novice and therefore any instructions need to be idiot

proof.

I have several spreadsheets that I receive daily.

I seem to do the same routines on a daily basis and was therefore

wondering
if it can be automated.

This is what I do on a daily basis: -

Open them;

Position on the second column and depress END and down arrow (to get

me to
the last row);

Retype the value that is currently in that cell (i.e. if it say 578, I

just
retype it) and change the format of the cell from a date format

(dd/mm/yy)
to
a general number. The reason I retype the value is that there is a

formula
in
the cell;

I then manually delete all the rows except the first and the last

rows.

I have tried to record a macro but it inserts a cell references and
unfortunately this doesn't work as the range to be deleted changes on

a
daily
basis.

Can the above task(s) be automated so that I just run a macro?


Any help offered would me appreciated.

--
Thanks

Ann






  #5   Report Post  
Ann
 
Posts: n/a
Default

Bob,

Once again thanks. It works except that I have to manually reformat the cell
B2 (after the delete) to Number Format - General.

I recorded a macro and it gave :-
Range("B2").Select
Selection.NumberFormat = "General"

I therefore added this to the macro you supplied and all is well.

Thanks again for you invaluable help.

Ann
--
Thanks

Ann


"Bob Phillips" wrote:

Sorry, I dropped a dot. Try this

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = .Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub

--
HTH

Bob Phillips

"Ann" wrote in message
...
Bob,

Thanks for the simple instruction.

The macro deletes the rows as requested, however, the value is blanked out
(i.e. last rows cell B.

Any ideas why this is happening?

Thanks
--
Thanks

Ann


"Bob Phillips" wrote:

Add this to a standard code module.

Got to the VB IDE - ALt-F11
Insert a code module - InsertModule
Paste this code

Sub Reformat()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
With Cells(iLastRow, "B")
.Value = Value
End With
Rows("2:" & iLastRow - 1).Delete

End Sub


--
HTH

Bob Phillips

"Ann" wrote in message
...
Firstly, I am a novice and therefore any instructions need to be idiot
proof.

I have several spreadsheets that I receive daily.

I seem to do the same routines on a daily basis and was therefore
wondering
if it can be automated.

This is what I do on a daily basis: -

Open them;

Position on the second column and depress END and down arrow (to get

me to
the last row);

Retype the value that is currently in that cell (i.e. if it say 578, I
just
retype it) and change the format of the cell from a date format

(dd/mm/yy)
to
a general number. The reason I retype the value is that there is a

formula
in
the cell;

I then manually delete all the rows except the first and the last

rows.

I have tried to record a macro but it inserts a cell references and
unfortunately this doesn't work as the range to be deleted changes on

a
daily
basis.

Can the above task(s) be automated so that I just run a macro?


Any help offered would me appreciated.

--
Thanks

Ann






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
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 05:28 AM.

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"