Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Macro - Insert Equal Sign to Convert String to Formula

Hello,

I am attempting to write a simple macro
--
Thanks again...
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Macro - Insert Equal Sign to Convert String to Formula

Sorry, I think I hit the post button on accident? Allow me to expand on my
own previous post...

I am attempting to write a macro to insert a prefix to each cell in a column
of string values. The prefix will be an equal sign; My intent is that the
string values will execute as formulas once the macro has been executed.

Any guidance/assistance is greatly appreciated.
--
Thanks again...


"Access''03_NewUser" wrote:

Hello,

I am attempting to write a simple macro
--
Thanks again...

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro - Insert Equal Sign to Convert String to Formula

Option Explicit
Sub testme01()

Dim myRng As Range
Dim myCell As Range

Set myRng = Nothing

On Error Resume Next
With Worksheets("Somesheetnamehere")
Set myRng = .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)) _
.SpecialCells(xlCellTypeConstants)
End With
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "No constants!"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell
.NumberFormat = "General"
.Formula = "=" & .Value
End With
Next myCell

End Sub


Access''03_NewUser wrote:

Sorry, I think I hit the post button on accident? Allow me to expand on my
own previous post...

I am attempting to write a macro to insert a prefix to each cell in a column
of string values. The prefix will be an equal sign; My intent is that the
string values will execute as formulas once the macro has been executed.

Any guidance/assistance is greatly appreciated.
--
Thanks again...

"Access''03_NewUser" wrote:

Hello,

I am attempting to write a simple macro
--
Thanks again...


--

Dave Peterson
  #4   Report Post  
Junior Member
 
Posts: 8
Default

I have this macro working for me, however, I need to apply it to multiple sheets in a workbook, but not all of them. Is there a way to apply this macro to multiple sheets? I would prefer not to add a loop if possible.


Quote:
Originally Posted by Dave Peterson View Post
Option Explicit
Sub testme01()

Dim myRng As Range
Dim myCell As Range

Set myRng = Nothing

On Error Resume Next
With Worksheets("Somesheetnamehere")
Set myRng = .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)) _
.SpecialCells(xlCellTypeConstants)
End With
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "No constants!"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell
.NumberFormat = "General"
.Formula = "=" & .Value
End With
Next myCell

End Sub


Access''03_NewUser wrote:

Sorry, I think I hit the post button on accident? Allow me to expand on my
own previous post...

I am attempting to write a macro to insert a prefix to each cell in a column
of string values. The prefix will be an equal sign; My intent is that the
string values will execute as formulas once the macro has been executed.

Any guidance/assistance is greatly appreciated.
--
Thanks again...

"Access''03_NewUser" wrote:

Hello,

I am attempting to write a simple macro
--
Thanks again...


--

Dave Peterson

Last edited by abbruno : October 18th 12 at 05:35 PM Reason: Change Notification Type
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
Formula bar doesn't have an equal sign Joes Auto Pat Excel Worksheet Functions 1 June 16th 06 08:06 PM
how do i get the equal sign on my formula bar in excel Bigfoot Excel Worksheet Functions 1 April 20th 06 12:24 PM
Need macro to insert text string while inside cell (formula) BrianB Excel Discussion (Misc queries) 0 May 31st 05 03:18 PM
why does Equal sign not appear on the formula bar pvmonsour Excel Discussion (Misc queries) 1 January 24th 05 11:46 PM
why does Equal sign not appear on the formula bar Paul Excel Discussion (Misc queries) 0 January 24th 05 11:13 PM


All times are GMT +1. The time now is 02:47 PM.

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"