LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Changing format of data

keesberbee wrote:
Dear Franz,
Thanks for your reply. Hereby i attach the macro. As the macro shows
it includes alot of copy and paste codes. I suggest that experienced
VBA users know better and faster ways to execute this task.


+-------------------------------------------------------------------+
Filename: Macro.doc |
Download: http://www.excelforum.com/attachment.php?postid=4973 |

+-------------------------------------------------------------------+


Hi,

Here is the modified macro:

Sub MoveData()
'
'
'
'
' Keyboard Shortcut: Ctrl+k
'
Dim lastrow As Long, newlr As Long

lastrow = Range("A65536").End(xlUp).Row


Range("C2:C" & lastrow).Copy Range("B" & lastrow).Offset(1, 0)
Range("C2:C" & lastrow).Clear
Range("D2:D" & lastrow).Copy Range("B" & 2 * lastrow)
Range("D2:D" & lastrow).Clear
Range("A2:A" & lastrow).Copy Range("A" & lastrow).Offset(1, 0)
Range("A2:A" & lastrow).Copy Range("A" & 2 * lastrow)
Application.CutCopyMode = False
Columns("A:A").Insert Shift:=xlToRight
Range("C1").Copy Range("A2:A" & lastrow)
Range("C1").Clear
Range("D1").Copy Range("A" & lastrow + 1 & ":A" & 2 * lastrow - 1)
Range("D1").Clear
Range("E1").Copy Range("A" & 2 * lastrow & ":A" & 3 * lastrow - 2)
Range("E1").Clear
Range("A1").Value = "Month"
Range("C1").Value = "Rev"
With Range("A1:C1")
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With
Range("A1").Select

End Sub




--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy


 
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
Changing the format of data in a cell dmdhca New Users to Excel 3 January 1st 09 06:51 AM
How do you keep the data table format from changing diehard22 Charts and Charting in Excel 0 August 11th 06 04:02 PM
Format several pages at once w/o data changing (Excel). Marie D Excel Discussion (Misc queries) 4 September 20th 05 09:48 PM
Changing data format frustratedwthis Excel Discussion (Misc queries) 1 May 11th 05 06:57 PM
Changing the format of a block of data Greg Excel Discussion (Misc queries) 0 January 23rd 05 02:30 AM


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