A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro from cell specific to whole column



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2010, 10:06 PM posted to microsoft.public.excel.misc
Bean Counter[_3_]
external usenet poster
 
Posts: 16
Default Macro from cell specific to whole column

Hello All,

I have recorded the following macro...

ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)"
Range("O286").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])"

that basically takes a text stored number such as 100.54- to -100.54. What
I want to do is make this auto fill for the entire column. How should
rewrite it?
--
Thanks for all of the help. It is much appreciated!!!!
  #2  
Old May 26th, 2010, 09:52 AM posted to microsoft.public.excel.misc
PY & Associates[_2_]
external usenet poster
 
Posts: 14
Default Macro from cell specific to whole column

On May 26, 5:06*am, Bean Counter
wrote:
Hello All,

I have recorded the following macro...

* * ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)"
* * Range("O286").Select
* * ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])"

that basically takes a text stored number such as 100.54- to -100.54. *What
I want to do is make this auto fill for the entire column. *How should
rewrite it?
--
Thanks for all of the help. *It is much appreciated!!!!


next line
Range(ActiveCell, ActiveCell.End(xlDown)).FillDown
  #3  
Old May 26th, 2010, 04:59 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Macro from cell specific to whole column

Try this version...........

Sub Negsignleft()
Dim Cell As Range
Dim rng As Range
On Error Resume Next
Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
On Error GoTo 0
For Each Cell In rng
If IsNumeric(Cell.Value) Then
Cell.Value = CDbl(Cell.Value) * 1
End If
Next Cell
End Sub


Gord Dibben MS Excel MVP

On Tue, 25 May 2010 14:06:01 -0700, Bean Counter
wrote:

Hello All,

I have recorded the following macro...

ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)"
Range("O286").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])"

that basically takes a text stored number such as 100.54- to -100.54. What
I want to do is make this auto fill for the entire column. How should
rewrite it?


  #4  
Old May 27th, 2010, 10:45 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Macro from cell specific to whole column

Try the below instead' which will convert any text with trailing - to
numbers...

Sub Macro()
Selection.TextToColumns Destination:=Selection, _
DataType:=xlDelimited, TrailingMinusNumbers:=True
End Sub

--
Jacob (MVP - Excel)


"Bean Counter" wrote:

Hello All,

I have recorded the following macro...

ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)"
Range("O286").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])"

that basically takes a text stored number such as 100.54- to -100.54. What
I want to do is make this auto fill for the entire column. How should
rewrite it?
--
Thanks for all of the help. It is much appreciated!!!!

  #5  
Old May 27th, 2010, 11:04 PM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 7,584
Default Macro from cell specific to whole column

Don't both with the rewrite.

Once you deposited a good formula in a single cell, use copy/paste to fill
the rest of the column.

After all, if the approach is good enough for a human, it should be good
enough for your macro.
--
Gary''s Student - gsnu201003


"Bean Counter" wrote:

Hello All,

I have recorded the following macro...

ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)"
Range("O286").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])"

that basically takes a text stored number such as 100.54- to -100.54. What
I want to do is make this auto fill for the entire column. How should
rewrite it?
--
Thanks for all of the help. It is much appreciated!!!!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.