PC Review


Reply
Thread Tools Rate Thread

Cleanup this macro please

 
 
Revenue
Guest
Posts: n/a
 
      11th Nov 2010
Ok, its been a while since I wrote anything like this customized so I
have forgotten a lot. I recorded the macro below to basically convert
a column of 6 character entries from Text to Values, An example is
201010 where its format is text and it needs to be a numeric 201010. I
can't find a suitable way in excel without using visual basic to
convert the column. Each cell has a different value, just in case
you're wondering that. The recorded macro is :

Sub prmo()

Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Range("G2").Select
ActiveCell.FormulaR1C1 = "=VALUE(RC[-1])"
Selection.Copy
Range("G3:G844").Select
ActiveSheet.Paste
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Range("F2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("G:G").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("F6").Select
End Sub
 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      11th Nov 2010
On Nov 11, 12:16*pm, Revenue <revi...@mewbourne.com> wrote:
> basically [want to] convert
> a column of 6 character entries from Text to Values, An example is
> 201010 where its format is text and it needs to be a numeric 201010.
> I can't find a suitable way in excel


Put the number 1 into a cell and copy it (ctrl-C). Select the cells
with numeric text, right-click and click Paste Special > Multiply >
OK. You can now delete the 1.
 
Reply With Quote
 
Revenue
Guest
Posts: n/a
 
      11th Nov 2010
Wasn't exactly the approach I had in mind, but I finally incorporated
that approach of multiplying by 1 into a macro and it works. Had to
assign a permanent range name the value of 1, rather than assign 1 to
a variable and then try and copy it and paste special with the
variable.

Thanks for the idea....

Bruce




 
Reply With Quote
 
joeu2004
Guest
Posts: n/a
 
      12th Nov 2010
On Nov 11, 2:08*pm, Revenue <revi...@mewbourne.com> wrote:
> Wasn't exactly the approach I had in mind, but I finally incorporated
> that approach of multiplying by 1 into a macro and it works.


If you insist on a macro, try:

Sub doit()
Selection.NumberFormat = "General"
x = Selection.Value
Selection.Value = x
End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone help Cleanup my recorded macro Kelly******** Microsoft Excel Misc 0 18th Apr 2008 07:51 PM
SORTING MACRO TO CLEANUP MESSY SHEET stefsailor Microsoft Excel Programming 10 16th Mar 2008 02:55 PM
Disk cleanup won't cleanup =?Utf-8?B?Y2hhcmxvdHRlYjEyMw==?= Windows XP General 5 16th Oct 2005 03:50 AM
cleanup =?Utf-8?B?UGV0ZXI=?= Windows XP General 3 15th Jan 2005 08:51 AM
DNS Cleanup =?Utf-8?B?RG1hbg==?= Microsoft Windows 2000 1 12th Oct 2003 03:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:25 PM.