Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to I select a row of cells in e

Status
Not open for further replies.

rohman

Programmer
Nov 2, 2003
10
US
How to I select a row of cells in excell using a loop. I want the loop to go through each cell, copy its content(path to a file) and then I want that path to be inserted into a variable that I pass onto InsertFile command.

For Each Cell In currDataSheet.Cells.Range("B2:B4")
Filename = currDataSheet.Select(Cell)


appWord.Selection.InsertFile Filename, Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Next Cell

Something like that, except that it works. I keep getting type mismatch error.
 
Nevermind the above post, I figured it out. But now I have a different problem.

Here is my code:

Dim Lr, Nr As Range
For Each Lr In Range("D13:D16")
If Lr = "Yes" Then
Nr = Lr.Offset(0, 1)
Filename = Nr
appWord.Selection.InsertFile Filename, Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Else
End If
Next

I got the cells to select that contain yes and no, but how do I select the content of the cells that are next to cells with yes or no?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top