Add = sign to table of numbers

D

Dewayne

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.
 
J

JLatham

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
 
D

Dewayne

Thank you J
--
Dewayne


JLatham said:
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 said:
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.
 
J

JLatham

Glad I was able to make things a bit easier for you.

Dewayne said:
Thank you J
--
Dewayne


JLatham said:
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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top