Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with copying Excel cell values
#1
Hi everybody!
I'm stuck with an Excel+QM question, looking for assistance.

I need to programmatically copy non-empty cell value from the above cell to the current cell, in the same column.
("A1") copy to ("A2"), ("B1") copy to ("B2"), ("C1") copy to ("C2")

This piece of code seems to be correct, but it doesn't work anyway.
 
Code:
Copy      Help
Macro [b]VBEObjectBrowserCrawler[/b] [help1][/help1]
[code],;Fill empty cell (A, B, C) from cells above
,_s = a.ActiveCell.Offset(-1,0).Value
,if (!_s.len) = 0
,,for _i 0 2
,,,_s = a.ActiveCell.Offset(-1,_i).Value
,,,out _s ;; -> A1 cell value
,,,a.ActiveCell.Offset(0,_i).Value = _s
,,,out _s ;; -> A1 cell value
[/code]




Can someone give me some pointers why the "a.ActiveCell.Offset(0, _i).Value = _s" string doesn't work for me?
#2
Works if changed s -> _s in line 2.
#3
Gintaras, thank you for the answer.
My mistake.

QM is terrific!
So powerful!


Forum Jump:


Users browsing this thread: 1 Guest(s)