ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveCell.FormulaR1C1 question (https://www.excelbanter.com/excel-programming/375785-activecell-formular1c1-question.html)

OMAR

ActiveCell.FormulaR1C1 question
 
The next code pretends to copy the values from a column, paste them in
another column and assign the correct format for each single cell. For this
last part I mean to:
1) press F2
2) press Enter

This combination of keys changes the cell's format, have you tried it? (Not
at the same time) Well, that's what I use to change cell's values format.
Anyway, when I was recording the macro, the VBA "builder" interpreted it as:
ActiveCell.FormulaR1C1 = 'Here goes the cell's value

It works for same cases, but not for all. I have some questions about it:
I. Did you understand me?
II. How can I change automatically "09/01/01" to "9 de Enero de 2001" (In my
country, the date order is represented as: DD/MM/YY)

Sub Macro4()
Dim celda, renglon, valor
renglon = 2
Range("AC2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("AD2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Do While renglon < 2311
celda = "AD" & renglon
Range(celda).Select
valor = Range(celda).Value
Range(celda).Activate
ActiveCell.FormulaR1C1 = valor
renglon = renglon + 1
Loop
Application.CutCopyMode = False
celda = "AD2"
Range(celda).Select
Range(celda).Activate
End Sub

Thanks in advance.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com