Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Changing text to formula in a range of cells

I'm new in Excel having recently moved from another spreadsheet brand that
didn't require the "=" preceding a formula so I'm constantly running into the
problem of having to go back and insert the "=" in each formula cell. To do
this, I came up with:

Sub Equation()

With Selection
.FormulaR1C1 = "=" & .FormulaR1C1
End With

End Sub

.... which works perfectly as long as only one cell is selected. If I select
a range of cells I get the error message:

Run-time error '13':
Type mismatch

What to do?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Changing text to formula in a range of cells

How about looping.

Dim rng As Range, cell As Range
Set rng = Selection
For Each cell In rng.Cells
cell.FormulaR1C1 = "=" & cell.Value
Next

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"Bob Arnett" wrote in message
...
I'm new in Excel having recently moved from another spreadsheet brand that
didn't require the "=" preceding a formula so I'm constantly running into
the
problem of having to go back and insert the "=" in each formula cell. To
do
this, I came up with:

Sub Equation()

With Selection
.FormulaR1C1 = "=" & .FormulaR1C1
End With

End Sub

... which works perfectly as long as only one cell is selected. If I
select
a range of cells I get the error message:

Run-time error '13':
Type mismatch

What to do?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Changing text to formula in a range of cells

You will want to iterate through the cells in the Selection...

Dim R As Range
For Each R In Selection
R.FormulaR1C1 = "=" & R.FormulaR1C1
Next

Rick


"Tim Zych" <tzych@NOSp@mE@RTHLINKDOTNET wrote in message
...
How about looping.

Dim rng As Range, cell As Range
Set rng = Selection
For Each cell In rng.Cells
cell.FormulaR1C1 = "=" & cell.Value
Next

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"Bob Arnett" wrote in message
...
I'm new in Excel having recently moved from another spreadsheet brand
that
didn't require the "=" preceding a formula so I'm constantly running into
the
problem of having to go back and insert the "=" in each formula cell. To
do
this, I came up with:

Sub Equation()

With Selection
.FormulaR1C1 = "=" & .FormulaR1C1
End With

End Sub

... which works perfectly as long as only one cell is selected. If I
select
a range of cells I get the error message:

Run-time error '13':
Type mismatch

What to do?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Changing text to formula in a range of cells

Sorry... I accidentally sent this post when I actually meant to cancel it.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
You will want to iterate through the cells in the Selection...

Dim R As Range
For Each R In Selection
R.FormulaR1C1 = "=" & R.FormulaR1C1
Next

Rick


"Tim Zych" <tzych@NOSp@mE@RTHLINKDOTNET wrote in message
...
How about looping.

Dim rng As Range, cell As Range
Set rng = Selection
For Each cell In rng.Cells
cell.FormulaR1C1 = "=" & cell.Value
Next

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"Bob Arnett" wrote in message
...
I'm new in Excel having recently moved from another spreadsheet brand
that
didn't require the "=" preceding a formula so I'm constantly running
into the
problem of having to go back and insert the "=" in each formula cell. To
do
this, I came up with:

Sub Equation()

With Selection
.FormulaR1C1 = "=" & .FormulaR1C1
End With

End Sub

... which works perfectly as long as only one cell is selected. If I
select
a range of cells I get the error message:

Run-time error '13':
Type mismatch

What to do?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Changing text to formula in a range of cells

Cool! Worked perfectly. I'll get the hang of this yet.

"Tim Zych" wrote:

How about looping.

Dim rng As Range, cell As Range
Set rng = Selection
For Each cell In rng.Cells
cell.FormulaR1C1 = "=" & cell.Value
Next

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"Bob Arnett" wrote in message
...
I'm new in Excel having recently moved from another spreadsheet brand that
didn't require the "=" preceding a formula so I'm constantly running into
the
problem of having to go back and insert the "=" in each formula cell. To
do
this, I came up with:

Sub Equation()

With Selection
.FormulaR1C1 = "=" & .FormulaR1C1
End With

End Sub

... which works perfectly as long as only one cell is selected. If I
select
a range of cells I get the error message:

Run-time error '13':
Type mismatch

What to do?




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
Changing the range for averages with out changing the formula. JessLRC Excel Worksheet Functions 0 April 20th 10 03:10 PM
Copy formula into multiple cells without changing range frankjh19701 Excel Worksheet Functions 4 December 28th 06 03:45 PM
Pasting a formula in multiple cells without changing the range Jeff Wheeler Excel Discussion (Misc queries) 3 June 15th 06 04:52 PM
monitoring a changing range of cells Kevin Excel Worksheet Functions 1 June 3rd 05 04:54 PM
Changing color on a range of cells Pete Excel Programming 3 December 31st 03 10:03 PM


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