+ Reply to Thread
Results 1 to 5 of 5

ClearContents selectively

  1. #1
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264

    ClearContents selectively

    In a macro I have the following line of code that clears all cells in the row.

    Please Login or Register  to view this content.
    I want it to only clear the contents of A:C, K, L:Y, AB:AC and AG:AO

    I have tried adding these as a range after the rows statement but it doesn't work.

    I guess there is a simple solution but as VB is not my strong point, I can't see it.

    grateful any assistance

    Ed

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Do you mean

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Hi Roy,

    Thanks for that.

    what I want is:

    Please Login or Register  to view this content.
    This forms part of a larger code block (devised by jasoncw):

    Please Login or Register  to view this content.
    The remaining cells in the row contain formulae and, if the row is the first and only row completed, the original code (I think it's this bit)

    Please Login or Register  to view this content.
    deleted these and, any subsequent data input was not evaluated. If there are multiple rows the problem does not occur.

    I put this in following your suggestion

    Please Login or Register  to view this content.
    and get 'run time error 1004'.

    Is this due to too many parameters or am I misunderstanding the coding?

    Ed

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This line sets the range to a row in srcWs.

    Please Login or Register  to view this content.
    This part is specifing the whole column
    Please Login or Register  to view this content.
    Try this instead

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Hi Roy,

    Thanks for that - it looks like it does exactly what I want.

    Regards

    Ed

+ 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