1

I have an Excel macro that populates a graph from .csv files, with values starting from cells A1, B1 in x and y axes. Now when I add multiple .csv files with values ranging from A3, B3, it throws an error saying the cells are empty. Any idea why this happens?

6
  • Can you share the code that you are using? Commented May 10, 2012 at 16:34
  • 2shared.com/file/Y-zly51v/macro_test.html Commented May 10, 2012 at 16:44
  • The following folder has a macro file and two .csv files, the macro works if one of the files is deleted.. Commented May 10, 2012 at 16:45
  • Which line is giving you the error? I got an error on a different line which was expected but I am not getting the error that you have mentioned above. Commented May 10, 2012 at 16:54
  • this line Plot_y = .Range("B1",Selection.End(xlDown)).Rows.Count Commented May 10, 2012 at 17:08

1 Answer 1

2

Change the lines

Plot_y = Range("C1", Selection.End(xlDown)).Rows.Count
Plot_x = Range("D1", Selection.End(xlDown)).Rows.Count

to

Plot_y = Range("C" & Rows.Count).End(xlUp).Row
Plot_x = Range("D" & Rows.Count).End(xlUp).Row

And try again.

Sign up to request clarification or add additional context in comments.

2 Comments

I get an error called "invalid or unqualified reference" after making this change in the very same lines
sorry my mistake, I had directly typed it here. Remove the dots before .Rows updating my post above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.