excel cell value

1 view (last 30 days)
Samer Husam
Samer Husam on 11 Jun 2012
hi all, how can I check the value of a cell in excel ? something like:
a= str2double(get(handles.edit1,'string'));
if xlsread('C:\Data sheet.xlsx','Sheet1',A1,'value')==1
xlswrite('C:\Data sheet.xlsx',a,'Sheet1',A1);
else
xlswrite('C:\Data sheet.xlsx',a,'Sheet1',A2);
end
  2 Comments
Samer Husam
Samer Husam on 10 Jul 2012
Hi Mark, thanks for your suggestion but so far I have a question about the code you post, I couldn't find where the part that you write in the excel after using the Activex, can you please mentions it in your code ?? thanks a lot for your answer..

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 8 Jul 2012
Edited: Walter Roberson on 8 Jul 2012
I am not certain of what you are asking for, but perhaps
a= str2double(get(handles.edit1,'string'));
if xlsread('C:\Data sheet.xlsx', 'Sheet1', 'A1:A1') == 1
xlswrite('C:\Data sheet.xlsx' ,a, 'Sheet1', 'A1:A1');
else
xlswrite('C:\Data sheet.xlsx', a, 'Sheet1', 'A2:A2');
end
This sequence relies upon the fact that the first output argument from xlsread() will be a numeric array containing the data; and of course that a numeric array of size 1x1 is a scalar.
  1 Comment
Samer Husam
Samer Husam on 9 Jul 2012
it suppose to check the cells values for column A starting from A1 and write in Empty cell only..

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!