+ Reply to Thread
Results 1 to 3 of 3

Copy, then delete table contents

  1. #1
    Registered User
    Join Date
    02-23-2012
    Location
    None
    MS-Off Ver
    Word 2003
    Posts
    1

    Copy, then delete table contents

    Using Word 2003

    Hey everyone,

    -I have a table with 2 columns and 5 rows
    -There is 1 command button to copy the ENTIRE table, and another button to delete the contents of column 2 (beginning with row 2)
    -Using the Protect Document feature, i have applied Editing Restrictions to the document (No Changes - read only), and added Exceptions for rows 2, 3, 4, 5 or column 2, which can be edited
    -Users are ONLY able to populate the cells in column 2, rows 2 through 5

    Below is my VBA code. The copy1 works fine, but i can't get the clear1 to perform the above.

    Any help would be appreciated.


    Private Sub copy1_Click()
    Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst, _
    Count:=1, Name:=""
    Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
    Selection.MoveDown Unit:=wdLine, Count:=12, Extend:=wdExtend
    Selection.Copy
    End Sub

    Private Sub clear1_Click()
    Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst, _
    Count:=1, Name:=""
    Selection.MoveRight Unit:=wdCharacter, Count:=14
    Selection.MoveDown Unit:=wdLine, Count:=12, Extend:=wdExtend
    Selection.Delete Unit:=wdCharacter, Count:=1
    End Sub

    Local Time: 03:05 PM
    Local Date: 02-23-2012
    Location:

  2. #2
    Registered User
    Join Date
    01-26-2012
    Location
    Slovenia; Kranj
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Copy, then delete table contents

    Hi,

    just quick answer while waiting a taxi

    I know that I'm using those two lines for something similar ...

    Please Login or Register  to view this content.
    ... tt is moving for a whole cell ... and I’m missing in your code ...

    Please Login or Register  to view this content.
    ... before "deleting" line ... this code select "what need to be deleted".



    Hope this helps ... cheers, Marko

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Copy, then delete table contents

    Quote Originally Posted by rbh123456789 View Post
    -I have a table with 2 columns and 5 rows
    -There is 1 command button to copy the ENTIRE table, and another button to delete the contents of column 2 (beginning with row 2)
    -Using the Protect Document feature, i have applied Editing Restrictions to the document (No Changes - read only), and added Exceptions for rows 2, 3, 4, 5 or column 2, which can be edited
    -Users are ONLY able to populate the cells in column 2, rows 2 through 5

    Below is my VBA code. The copy1 works fine, but i can't get the clear1 to perform the above.
    Cross-posted at: http://www.vbaexpress.com/forum/showthread.php?t=41064
    and the code in your post isn't formatted. Please read Rules 4 & 8: http://www.excelforum.com/forum-rule...rum-rules.html
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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