ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add = sign to table of numbers (https://www.excelbanter.com/excel-discussion-misc-queries/240366-add-%3D-sign-table-numbers.html)

Dewayne

Add = sign to table of numbers
 
I have a large table with numbers only in it i.e. 1234.5
I need to make these numbers part of a formula now by adding an equal sign
to each number in the table i.e. =1234.5+L62.
Is there a way to have Excel add the = sign to the cells without having to
go into each cell and manually add it?
Thanks for any suggestions.
--
Dewayne

JLatham

Add = sign to table of numbers
 
This code will take a selected group of cells and add an = symbol to the
beginning of them. Only tested with cells containing numbers/empty cells.
Probably create incredible errors if you use it with cells containing text.

Open the workbook, press [Alt]+[F11] to open the VB Editor. In the VBE,
choose Insert -- Module and copy and paste the code below into the new
module. Close the VB Editor. Select the cells you need to add the= symbol
to and then use Tools -- Macro -- Macros to run the code. I'll leave it to
you to add the "+L..." since I assume that the row number is probably going
to change. But if it was always to be "+L62" then you could change the one
line below to:
anyCell.Formula = "=" & anyCell.Value & "+L62"




Sub MakeItAFormula()
'select the cells you want to change
'and then call this routine from
' Tools -- Macro -- Macros
Dim anyCell As Range
For Each anyCell In Selection
If Not IsEmpty(anyCell) And _
Not anyCell.HasFormula Then
anyCell.Formula = "=" & anyCell.Value
End If
Next
End Sub


"Dewayne" wrote:

I have a large table with numbers only in it i.e. 1234.5
I need to make these numbers part of a formula now by adding an equal sign
to each number in the table i.e. =1234.5+L62.
Is there a way to have Excel add the = sign to the cells without having to
go into each cell and manually add it?
Thanks for any suggestions.
--
Dewayne


Dewayne

Add = sign to table of numbers
 
Thank you J
--
Dewayne


"JLatham" wrote:

This code will take a selected group of cells and add an = symbol to the
beginning of them. Only tested with cells containing numbers/empty cells.
Probably create incredible errors if you use it with cells containing text.

Open the workbook, press [Alt]+[F11] to open the VB Editor. In the VBE,
choose Insert -- Module and copy and paste the code below into the new
module. Close the VB Editor. Select the cells you need to add the= symbol
to and then use Tools -- Macro -- Macros to run the code. I'll leave it to
you to add the "+L..." since I assume that the row number is probably going
to change. But if it was always to be "+L62" then you could change the one
line below to:
anyCell.Formula = "=" & anyCell.Value & "+L62"




Sub MakeItAFormula()
'select the cells you want to change
'and then call this routine from
' Tools -- Macro -- Macros
Dim anyCell As Range
For Each anyCell In Selection
If Not IsEmpty(anyCell) And _
Not anyCell.HasFormula Then
anyCell.Formula = "=" & anyCell.Value
End If
Next
End Sub


"Dewayne" wrote:

I have a large table with numbers only in it i.e. 1234.5
I need to make these numbers part of a formula now by adding an equal sign
to each number in the table i.e. =1234.5+L62.
Is there a way to have Excel add the = sign to the cells without having to
go into each cell and manually add it?
Thanks for any suggestions.
--
Dewayne


JLatham

Add = sign to table of numbers
 
Glad I was able to make things a bit easier for you.

"Dewayne" wrote:

Thank you J
--
Dewayne


"JLatham" wrote:

This code will take a selected group of cells and add an = symbol to the
beginning of them. Only tested with cells containing numbers/empty cells.
Probably create incredible errors if you use it with cells containing text.

Open the workbook, press [Alt]+[F11] to open the VB Editor. In the VBE,
choose Insert -- Module and copy and paste the code below into the new
module. Close the VB Editor. Select the cells you need to add the= symbol
to and then use Tools -- Macro -- Macros to run the code. I'll leave it to
you to add the "+L..." since I assume that the row number is probably going
to change. But if it was always to be "+L62" then you could change the one
line below to:
anyCell.Formula = "=" & anyCell.Value & "+L62"




Sub MakeItAFormula()
'select the cells you want to change
'and then call this routine from
' Tools -- Macro -- Macros
Dim anyCell As Range
For Each anyCell In Selection
If Not IsEmpty(anyCell) And _
Not anyCell.HasFormula Then
anyCell.Formula = "=" & anyCell.Value
End If
Next
End Sub


"Dewayne" wrote:

I have a large table with numbers only in it i.e. 1234.5
I need to make these numbers part of a formula now by adding an equal sign
to each number in the table i.e. =1234.5+L62.
Is there a way to have Excel add the = sign to the cells without having to
go into each cell and manually add it?
Thanks for any suggestions.
--
Dewayne



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com