boukaka
asked on
set value of cell to the right of the last cell in a range
I am trying to set the value in the cell to the right of the last cell in a range but it isn't working. Can someone see what I'm doing wrong?
Set oWorkbook = Workbooks.Open(TextFile)
Set oRange = ActiveWorkbook.Worksheets( 1).UsedRan ge
For i = 1 To oRange.Rows.Count
Set oCurRow = oRange.Rows(i)
For Each oCell In oCurRow.Cells
If oCell.Value = sCusip Then
oCurRow.Columns(i, oCurRow.Columns.Count).Off set(0, 1).Value = "Y"
End If
Next
Next
Set oWorkbook = Workbooks.Open(TextFile)
Set oRange = ActiveWorkbook.Worksheets(
For i = 1 To oRange.Rows.Count
Set oCurRow = oRange.Rows(i)
For Each oCell In oCurRow.Cells
If oCell.Value = sCusip Then
oCurRow.Columns(i, oCurRow.Columns.Count).Off
End If
Next
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER