+ Reply to Thread
Results 1 to 4 of 4

Word VBA for loop to iterate through each cell selected by mouse

  1. #1
    Registered User
    Join Date
    12-08-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    Standard 2013
    Posts
    83

    Word VBA for loop to iterate through each cell selected by mouse

    I made this macro. I know a few lines are redundant but I thought that would be necessary to make it work. It still works to do what I want, but not across all cells I select- only in cell one.

    What I want it to do is paste GCR 8/13/2019 (current date) in all the cells selected, which are basically vertical columns. It's for long tedious workpaper checklists that I'm constantly having to fill out. I understand I can just type Ctrl+V but I like a challenge and being keyboard independent when I'm leaning back in my chair. Anyway I got my desired macro to work on first selected cell of my selected range but not each cell in the range. To try get it to work on them all, I've been studying the official Office Docs, selection, table, range, cells, cell, etc. I'm getting better at theory but when I try various things I think might work, I keep getting errors, mostly the "object does not support property or method" error.

    What I think I have to do is get a Cells object to get returned based on the range selected by the mouse (not cell, but cells, which are different objects, and which is a range object), which represents a collection of contiguous cells (I think). I think this is where I fail. Then I think I could do for loop to loop through all the cells, and then a cell.select() method to get a selection object, whereafter I can do the code that I know works, below. But I haven't figured it out. Any cheat code would be awesome.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Word VBA for loop to iterate through each cell selected by mouse

    ???
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-08-2017
    Location
    Minneapolis, MN
    MS-Off Ver
    Standard 2013
    Posts
    83

    Re: Word VBA for loop to iterate through each cell selected by mouse

    Thanks for your suggestions. They didn't work. First one was object doesn't support property or method. Second was a new error I never saw, method or data member not found.

    It could be noted I'm working with 3rd party checklists that have macros and such in them but as far as I know they behave like normal tables.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Word VBA for loop to iterate through each cell selected by mouse

    Sorry, I didn't "notice" it was about the Ms Word ...
    Could you attach a sample document (doc) with a table (of course with false data to protect data confidentiality).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Cross Sheet Input, Mouse Click and Selected Cell
    By vsShinobi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2019, 02:34 AM
  2. [SOLVED] Iterate through Array While in For Each loop
    By stusic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2017, 03:08 PM
  3. [SOLVED] For loop to iterate Cell Row in a Formula
    By Excelerate1 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-18-2017, 08:15 PM
  4. Getting mouse selected cell as input to start operations on data of that cell row
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2013, 01:48 AM
  5. Mouse/Curser drags when cell selected
    By LGR in forum Excel General
    Replies: 1
    Last Post: 10-15-2011, 01:41 PM
  6. to iterate within selected range and loop
    By dazzwilliams in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2011, 01:27 AM
  7. Iterate through a Range of selected Cells?
    By TonyHine in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-04-2009, 08:06 PM

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