Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Please help to store the followng formula in a string . I did the following
ways but not working . The purpose of the formula to convert string into date format. The formlula is working independantly. But it didnot working when I am trying to store in a variable. myFormula = "=IF(LEFT(CELL("format",RC[1]),1)="D",RC[1],DATE(LEFT(RC[1],4),MID(RC[1],5,2),RIGHT(RC[1],2)))" Sub sizeonly() Dim res As Variant Dim wks As Worksheet Dim LastRow As Long Dim myFormula As String Set wks = ActiveSheet With wks res = Application.Match("DATE", .Rows(2), 0) LastRow = .Cells(.Rows.Count, res).End(xlUp).Row .Columns(res).Insert 'add header in row 1 .Cells(2, res).Value = "YEAR" myFormula = "=IF(LEFT(CELL("format",RC[1]),1)="D",RC[1],DATE(LEFT(RC[1],4),MID(RC[1],5,2),RIGHT(RC[1],2)))" 'Here is not working pls help .Range(.Cells(3, res), .Cells(LastRow, res)).FormulaR1C1 = myFormula .Columns(res).AutoFit End With End Sub With thanks Polachan Paily |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can one store a string in a Array element? | Excel Discussion (Misc queries) | |||
store address in a cell and use it in formula | Excel Discussion (Misc queries) | |||
store inventory sheet(ex:sports equipment store) | Excel Worksheet Functions | |||
Store formula in Cell | Excel Discussion (Misc queries) | |||
Store formula in Cell | Excel Discussion (Misc queries) |