Clear Cells Content

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this VBA code to clear cells content, but it is not clearing the
content...

Set wkSheet = Worksheets(sName)

For iCount = 53 To 92
wkSheet.Cells(nRowNumber, iCount).Clear
Next

Why?
 
If I wanted to clear the cell's contents, I would have used:

wksheet.cells(nrownumber, icount).clearcontents

But your code should have worked ok. Are you sure you're looking at the correct
worksheet? And the correct row?
 
Pardon my confusion, but where is nRowNumber defined, and what is it's value?

As I understand the .Cells() property, it needs a (row, column) reference
and while the example formula shows a variable being used for the row
reference, I don't see where it is coming from? Could cells in wrong rows be
getting cleared?
 

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