+ Reply to Thread
Results 1 to 3 of 3

Clear Cells Content

  1. #1
    No_Spam
    Guest

    Clear Cells Content

    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?


  2. #2
    Dave Peterson
    Guest

    Re: Clear Cells Content

    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?



    No_Spam wrote:
    >
    > 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?


    --

    Dave Peterson

  3. #3
    JLatham
    Guest

    Re: Clear Cells Content

    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?

    "Dave Peterson" wrote:

    > 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?
    >
    >
    >
    > No_Spam wrote:
    > >
    > > 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?

    >
    > --
    >
    > Dave Peterson
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1