View Full Version : Solved: Determining the Active Cell...

Michael 514
04-09-2006, 06:49 PM
Hi guys!

Well, I'm back!

This time with a short snapper!

About a year ago, a few contributors here made a wonderful macro for me that reads Word documents and row-by-row, spits out the bookmark values.

Boy, do we love it!

Now, there is one thing I would like to change, and being the absolute VBA n00b, I figured I'd ask the pros!

By design, the macro prompts user for the beginning row in which to fill in the data (intRow), as well as the column (intCol).

This means that the user always has to type two numbers before running this macro.

I was wondering that instead of prompting the user for intRow and intCol, if there is a not a way to simply make intRow equal to the Row number of the current active cell, and intCol the Column number of the active cell.

This way, the user need only put the cursor on the cell in which the bookmark shall start pasting!

I hope this is possible!

Thanks for your ideas!

Here is where the variables are used!

'Loop through all the fields
For x = 1 To WordDoc.Bookmarks.Count

'intRow is the file order number (each file will import on a new row)
'the x is the column - Essentially it'll cycle through all the bookmarks
'in the Word doc

ActiveSheet.Cells(intRow + intFileNum, x + intCol - 1) = _

If Err.Number <> 0 Then
ActiveSheet.Cells(intRow + intFileNum, x + intCol - 1) = _
End If


Thanks so much!!!


Edited 10-Apr-06 by GeekGirlau. Reason: Insert line break in code

Jacob Hilderbrand
04-09-2006, 09:01 PM
Try this:

ActiveSheet.Cells(ActiveCell.Row + intFileNum, x + ActiveCell.Column - 1)

Michael 514
04-10-2006, 10:21 AM

ActiveCell.Row and ActiveCell.Column!

Love it!

Thanks a million!!!!!!!

Have a good one!


Jacob Hilderbrand
04-16-2006, 12:27 PM
You're Welcome :beerchug:

Take Care