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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -