Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default How to FIX Recorded Macro

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default How to FIX Recorded Macro

How about using something like

=Text(A1,0)

HTH,
Barb Reinhardt

"JMay" wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default How to FIX Recorded Macro

Thanks for your help. I suppose I was just lloking for the Macro line
which would mimic the pressing the F2 Ket and then Enter, I just did
it by itself (while recording) and got an error. hummmmm..
Thanks,


"Barb Reinhardt" wrote:

How about using something like

=Text(A1,0)

HTH,
Barb Reinhardt

"JMay" wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 461
Default How to FIX Recorded Macro

What's not working with it?... works fine for me.

"JMay" wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How to FIX Recorded Macro

Jim

Macros won't run while you are in Edit mode if I read correctly what you are
attempting.


Gord Dibben MS Excel MVP


On Tue, 22 May 2007 09:22:01 -0700, JMay wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default How to FIX Recorded Macro

AKphidelt -- Thanks for your comment. I went back and played with it a bit
more and came up with this (and added to my personal.xls file) - which is
what I wanted in the first place.
Thanks for the encouragement.

Sub NumToText()
' Macro recorded 5/22/2007 by Jim May
'
With ActiveCell
TFontName = .Font.Name
TFontSize = .Font.Size
End With
Selection.NumberFormat = "@"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = TFontName
.FontStyle = "Regular"
.Size = TFontSize
End With
End Sub



"AKphidelt" wrote:

What's not working with it?... works fine for me.

"JMay" wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default How to FIX Recorded Macro

Gord - Thanks for the comment. Even though I run this Macro after selecting
the subject cell, it still doesn't "register" as Text (Using the =ISTEXT()
function) until I do an F2 and Enter (meaning update it).. How can I do this
within the Macro?

Tks,

Jim May

Sub NumToText()
' Macro recorded 5/22/2007 by Jim May
'
With ActiveCell
TFontName = .Font.Name
TFontSize = .Font.Size
End With
Selection.NumberFormat = "@"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = TFontName
.FontStyle = "Regular"
.Size = TFontSize
End With
End Sub

"Gord Dibben" wrote:

Jim

Macros won't run while you are in Edit mode if I read correctly what you are
attempting.


Gord Dibben MS Excel MVP


On Tue, 22 May 2007 09:22:01 -0700, JMay wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How to FIX Recorded Macro

Jim

Your first macro posted works for me. The font changes take place and the
ISTEXT returns TRUE.

Your second macro does nothing but left-align the number in the cell.

Where are these declared?

TFontName
TFontSize

Your first again with the activecell.formulaR1C1 line un-remmed

Sub Macro1()
Selection.NumberFormat = "@"
ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End Sub

Gord


On Tue, 22 May 2007 16:05:01 -0700, JMay wrote:

Gord - Thanks for the comment. Even though I run this Macro after selecting
the subject cell, it still doesn't "register" as Text (Using the =ISTEXT()
function) until I do an F2 and Enter (meaning update it).. How can I do this
within the Macro?

Tks,

Jim May

Sub NumToText()
' Macro recorded 5/22/2007 by Jim May
'
With ActiveCell
TFontName = .Font.Name
TFontSize = .Font.Size
End With
Selection.NumberFormat = "@"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = TFontName
.FontStyle = "Regular"
.Size = TFontSize
End With
End Sub

"Gord Dibben" wrote:

Jim

Macros won't run while you are in Edit mode if I read correctly what you are
attempting.


Gord Dibben MS Excel MVP


On Tue, 22 May 2007 09:22:01 -0700, JMay wrote:

I want to create a macro that will convert a number to Text format
so that it can be read by another formula where the cell needs to be text.
Below is the result of turning on the recorder and doing as follows (with my
cell that needs fixing selected before):

Format, Cells, Text, OK
F2 pressed (To bring up in edit mode) + enter

But it doesn't seem to be working...
CAn someone assist?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/22/2007 by Jim May
'

'
Selection.NumberFormat = "@"
' ActiveCell.FormulaR1C1 = "879"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
' Range("L1149").Select
End Sub




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
Recorded Macro want to know New Users to Excel 5 February 14th 07 12:46 PM
I recorded a macro, how can i share it with others? TA Excel Worksheet Functions 1 September 8th 06 08:09 PM
Recorded Macro to Copy Format Lilbit Excel Worksheet Functions 5 January 10th 06 09:42 PM
using Goal Seek inside a recorded macro gvm Excel Worksheet Functions 5 July 21st 05 06:43 AM
Recorded macro: What happens if I change filename? [email protected] Excel Discussion (Misc queries) 2 January 26th 05 11:54 PM


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