Variable Error

  • Thread starter Thread starter ll
  • Start date Start date
L

ll

Hi,
I am working with a VBA form in Excel, and the code for the form
includes several sub's. In one of the subs, I set variable "c" equal
to the value of "i" which has been looping, so that, at the end of the
loop through the rows, "c" will equal the last row number. I want to
temporarily store the value of c in a cell. Here's the code for that:

c = i
Cells(1, 26).Value = c

Next, in the same form code, but another sub, I want to assign the
value in the previously mentioned cell (plus 7) to variable "i". See
code below:

i = Sheet1.Cells(1, 26).Value + 7

The problem is that I'm getting an error message that points to the
line in the first sub <Cells(1,26).Value=c>. Is there a problem with
syntax, etc?

Thanks,
Louis
 
Thanks for your help,
I tried that, but still got the error in the preceding code (Cells(1,
26).Value = c )
I put a value in the cell, and the second line of code (from the second
sub) picked it up and worked, so the problem seems to be in the first
sub, with assigning the cell the value of c.?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top