excel - Convert between two currencies by the click of a button in the same cells -
i want create function in excel workbook converts cells in 3 sheets using currency format 1 currency (sll) (dkk) click of button (the same button converts in sll or in dkk depending on currency values in).
my code is:
sub convertcurrency() dim userrate1 long dim userrate2 long each cell in activeworkbook.worksheets userrate1 = 625 if cells.numberformat = "dkk" & "$ #,##0.00" _ cell.value = "sll" & userrate1 * cell.value elseif cells.numberformat = "sll" & "$ #,##0.00" _ cell.value = "dkk" & (1 / userrate1) * cell.value _ end if end sub
but it's not working. error "compile error. else without if". how can use else without if, if need include second restriction.
sub test() dim userrate1 long dim userrate2 long each cell in activeworkbook.worksheets userrate1 = 625 if cells.numberformat = "dkk" & "$ #,##0.00" _ cell.value = userrate1 * cell.value if cells.numberformat = "sll" & "$ #,##0.00" _ cell.value = (1 / userrate1) * cell.value _ end sub
try this
Comments
Post a Comment