Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel question
#4
Macro
Code:
Copy      Help
;/exe 1
out
str sn="0000000000"
ARRAY(str) a
ExcelSheet es.Init
es.GetCells(a "sel") ;;gets selected cells

;this code gets 1-based row and column index of top-left cell of selection
Excel.Range sr=es.ws.Application.Selection
int sx(sr.Column) sy(sr.Row)

int r c
for r 0 a.len
,if(mes("Row %i" "" "OC" r+1) != 'O') break
,for c 0 a.len(1)
,,str& s=a[c r]
,,int x=3-s.len
,,if(x<=0) continue
,,s.fromn(sn x s s.len)
,,out s
,,es.SetCell(s c+sx r+sy)


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)