ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   To my left... (https://www.excelbanter.com/excel-discussion-misc-queries/105025-my-left.html)

Zamdrist

To my left...
 
How might I refer to and return a value of a cell just one over left
from my current cell range?

For Each Cell In rngRange
Cell.Select

If Selection.Value < "" Then
On Error Resume Next
Sh.Pictures.Insert(Selection.Value).Select
Selection.ShapeRange.ScaleWidth 0.47, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.47, msoFalse,
msoScaleFromTopLeft

Else
Exit Function
End If

Next Cell

Unfortunately this code continues down the spreasheet indefinately. I
need to Exit the For if the value of one cell left of Selection is = ""

Any help would be greatly appreciated. Thanks.


Bob Phillips

To my left...
 
For Each cell In rngRange
If cell.Offset(0, -1).Value < "" Then
On Error Resume Next
With Sh.Pictures.Insert(cell.Value)
.ShapeRange.ScaleWidth 0.47, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight 0.47, msoFalse, msoScaleFromTopLeft
End With
Else
Exit Function
End If

Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Zamdrist" wrote in message
ups.com...
How might I refer to and return a value of a cell just one over left
from my current cell range?

For Each Cell In rngRange
Cell.Select

If Selection.Value < "" Then
On Error Resume Next
Sh.Pictures.Insert(Selection.Value).Select
Selection.ShapeRange.ScaleWidth 0.47, msoFalse,
msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.47, msoFalse,
msoScaleFromTopLeft

Else
Exit Function
End If

Next Cell

Unfortunately this code continues down the spreasheet indefinately. I
need to Exit the For if the value of one cell left of Selection is = ""

Any help would be greatly appreciated. Thanks.




Zamdrist

To my left...
 
Thank you Bob



All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com