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

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -