Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default addspace macro

I created the following macro for a workbook:

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

It worked perfectly the first time I used it. I then attempted to self
certify the macro and in doing so changed some of my security settings. Now
the exact same macro won't run. I get no error... it just doesn't run. I
think I've reset everything back to the way it was, even deleted my self
certification, but I can't get it to work. Any thoughts?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default addspace macro

David,

Why do you think it isn't working. All the macro does (and you must have a
reason) is put a space in front of each cell in a selection and then
immediatly take that space away. It will work so fast you won't be able to
see it work.

One way to see if it is working is to put a STOP in the code and then run it

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
Stop
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

Mike

"David Ellis - Indiana State Fair Comm." wrote:

I created the following macro for a workbook:

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

It worked perfectly the first time I used it. I then attempted to self
certify the macro and in doing so changed some of my security settings. Now
the exact same macro won't run. I get no error... it just doesn't run. I
think I've reset everything back to the way it was, even deleted my self
certification, but I can't get it to work. Any thoughts?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default addspace macro

The column I have selected has both text and numbers. The text has the small
green triangle in the corner indicating a warning to this effect. When I ran
the macro the first time those warning indicators went away. Also, the
workbook is linked to an Access database. When I tried to append data from
the linked file I would get a "Numeric field overflow" error. I tracked that
error back to the text/number mix issue, created the macro and ran it, and
that fixed the error. Now when I run the macro I still get the error.

"Mike H" wrote:

David,

Why do you think it isn't working. All the macro does (and you must have a
reason) is put a space in front of each cell in a selection and then
immediatly take that space away. It will work so fast you won't be able to
see it work.

One way to see if it is working is to put a STOP in the code and then run it

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
Stop
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

Mike

"David Ellis - Indiana State Fair Comm." wrote:

I created the following macro for a workbook:

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

It worked perfectly the first time I used it. I then attempted to self
certify the macro and in doing so changed some of my security settings. Now
the exact same macro won't run. I get no error... it just doesn't run. I
think I've reset everything back to the way it was, even deleted my self
certification, but I can't get it to work. Any thoughts?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default addspace macro

as an alternative, you could format the colum as text

dim cell as range
range("D:D").NumberFormat = "@"
for each cell in range("D:D").Cells
cell.value = cell.value
next
range("D:D").NumberFormat = "General"




"David Ellis - Indiana State Fair Comm." wrote:

The column I have selected has both text and numbers. The text has the small
green triangle in the corner indicating a warning to this effect. When I ran
the macro the first time those warning indicators went away. Also, the
workbook is linked to an Access database. When I tried to append data from
the linked file I would get a "Numeric field overflow" error. I tracked that
error back to the text/number mix issue, created the macro and ran it, and
that fixed the error. Now when I run the macro I still get the error.

"Mike H" wrote:

David,

Why do you think it isn't working. All the macro does (and you must have a
reason) is put a space in front of each cell in a selection and then
immediatly take that space away. It will work so fast you won't be able to
see it work.

One way to see if it is working is to put a STOP in the code and then run it

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
Stop
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

Mike

"David Ellis - Indiana State Fair Comm." wrote:

I created the following macro for a workbook:

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

It worked perfectly the first time I used it. I then attempted to self
certify the macro and in doing so changed some of my security settings. Now
the exact same macro won't run. I get no error... it just doesn't run. I
think I've reset everything back to the way it was, even deleted my self
certification, but I can't get it to work. Any thoughts?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default addspace macro

When I try to create the Macro you have suggested I get a "Wrong number of
arguments or invalid property assignment" error.

I don't really know VB. I copy the original Macro from MicroSoft.

I have tried to simply highlight the range in question and format it as Text
using the Format menue. That didn't solve my problem

"Patrick Molloy" wrote:

as an alternative, you could format the colum as text

dim cell as range
range("D:D").NumberFormat = "@"
for each cell in range("D:D").Cells
cell.value = cell.value
next
range("D:D").NumberFormat = "General"




"David Ellis - Indiana State Fair Comm." wrote:

The column I have selected has both text and numbers. The text has the small
green triangle in the corner indicating a warning to this effect. When I ran
the macro the first time those warning indicators went away. Also, the
workbook is linked to an Access database. When I tried to append data from
the linked file I would get a "Numeric field overflow" error. I tracked that
error back to the text/number mix issue, created the macro and ran it, and
that fixed the error. Now when I run the macro I still get the error.

"Mike H" wrote:

David,

Why do you think it isn't working. All the macro does (and you must have a
reason) is put a space in front of each cell in a selection and then
immediatly take that space away. It will work so fast you won't be able to
see it work.

One way to see if it is working is to put a STOP in the code and then run it

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
Stop
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

Mike

"David Ellis - Indiana State Fair Comm." wrote:

I created the following macro for a workbook:

Sub addspace()
Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End Sub

It worked perfectly the first time I used it. I then attempted to self
certify the macro and in doing so changed some of my security settings. Now
the exact same macro won't run. I get no error... it just doesn't run. I
think I've reset everything back to the way it was, even deleted my self
certification, but I can't get it to work. Any thoughts?



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
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"