#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros

When pasting data from our main frame, negative numbers have the - sign at
the end. I need a macro to edit the cell, backspace, home, - enter. Any
ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Macros

Here is Gord Dibben's reply to a similar post:

Select the range.
DataText to ColumnsNextNextAdvanced. Checkmark in "trailing minus sign for
negative numbers"Finish. (This feature appeared with Excel 2002)

A macro if you wish.

Sub Negsignleft()
Dim cell As Range
Dim rng As Range
''move minus sign from right to left on entire worksheet
On Error Resume Next
Set rng = ActiveSheet.Cells. _
SpecialCells(xlCellTypeConstants, xlTextValues)
On Error GoTo 0
For Each cell In rng
If IsNumeric(cell.Value) Then
cell.Value = CDbl(cell.Value)
End If
Next cell
End Sub

Put the macro code in a general VBA module in your workbook. If you are new
to macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/200...e-elses-macro/

Hope this helps,

Hutch

"cheri gemini" wrote:

When pasting data from our main frame, negative numbers have the - sign at
the end. I need a macro to edit the cell, backspace, home, - enter. Any
ideas?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macros

hi
another way
since you didn't say, i assumed that your numbers would be in a column. i
chose column F for test purposes only. adjust to suit.
Sub changeit()
Dim r As Range
Dim lr As Long
lr = Cells(Rows.Count, "f").End(xlUp).Row
Set r = Range("F2:F" & lr)
For Each cell In r
'cell.Select 'not needed. test pruposes only.
cell.Value = "-" & Left(cell, Len(cell) - 1)
Next cell

End Sub

regards
FSt1
"cheri gemini" wrote:

When pasting data from our main frame, negative numbers have the - sign at
the end. I need a macro to edit the cell, backspace, home, - enter. Any
ideas?

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
Macros in Personal.xls that would create two toolbars and buttonswith assigned macros Brian Day Excel Programming 1 March 29th 07 11:20 PM
choose default macros Not Enabled / Macros Enable Setting BEEJAY Excel Programming 2 June 30th 06 01:07 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Excel Programming 0 December 12th 04 09:19 PM
Macros inside macros, and pasting into macro code. pagelocator[_2_] Excel Programming 1 November 24th 04 09:11 AM
Open workbook-macros enabled, opening another with macros George J Excel Programming 5 September 17th 04 02:07 PM


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