Pramodpandit123
New Member
- Joined
- Apr 18, 2020
- Messages
- 30
- Office Version
- 2016
- Platform
- Windows
I have a following formula on Excel cell that works fine but i want to put the formula on the cells using VBA .. Putting the formula using VBA gives me "Syntax error" during compiling.
Following is the formula that works on Excel cell :
Following is the VBA that gave me syntax error :
Following is the VBA that i want using Loop :
Following is the formula that works on Excel cell :
Excel Formula:
=IF(I10="","",IF(I10=0,0,ROUND(MAX(IF((LEN(I10)-FIND(".",I10&"."))={-1,2},CONVERT(DOLLARDE(I10,12),"ft","m")),IFERROR(CONVERT(DOLLARDE(INT(I10)&".0"&MID(I10,FIND(".",I10)+1,1),12),"ft","m"),0)),2)))
Following is the VBA that gave me syntax error :
VBA Code:
.Range("U" & 3 + i).Formula = "=IF(I4="""","""",IF(I4=0,0,ROUND(MAX(IF((LEN(I4)-FIND(".",I4&"."))={-1,2},CONVERT(DOLLARDE(I4,12),"ft","m")),IFERROR(CONVERT(DOLLARDE(INT(I4)&".0"&MID(I4,FIND(".",I4)+1,1),12),"ft","m"),0)),2)))"
Following is the VBA that i want using Loop :
VBA Code:
For i=1 to 8
.Range("u" & 3 + i).Formula = "=IF(I" & 3+i & "="""","""",IF(I" & 3+i & "=0,0,ROUND(MAX(IF((LEN(I" & 3+i & ")-FIND(".",I" & 3+i & "&"."))={-1,2},CONVERT(DOLLARDE(I" & 3+i & ",12),"ft","m")),IFERROR(CONVERT(DOLLARDE(INT(I" & 3+i & ")&".0"&MID(I" & 3+i & ",FIND(".",I" & 3+i & ")+1,1),12),"ft","m"),0)),2)))"
Next