ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select C6 down to last used cell, as determined in column B (https://www.excelbanter.com/excel-programming/384753-select-c6-down-last-used-cell-determined-column-b.html)

BEEJAY

Select C6 down to last used cell, as determined in column B
 
Column B ALWAYS has entries in each cell.
The entries in B always go to bottom of used range on worksheet.
Once last cell is determined, need to select Column C6 down to last cell,
in order to process the following code.

' Select C6 down to last used row

Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=($B6=""*"")"
Selection.FormatConditions(1).Interior.ColorIndex = 4

any help would be appreciated.

Robert[_34_]

Select C6 down to last used cell, as determined in column B
 
Range(Range("C6"), Range("C6").End(xlDown)).Select


Gary Keramidas

Select C6 down to last used cell, as determined in column B
 
maybe something like this

Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Dim lastrow As Long
lastrow = ws.Cells(Rows.Count, "B").End(xlUp).Row
ws.Range("C6:C" & lastrow).Select

--


Gary


"BEEJAY" wrote in message
...
Column B ALWAYS has entries in each cell.
The entries in B always go to bottom of used range on worksheet.
Once last cell is determined, need to select Column C6 down to last cell,
in order to process the following code.

' Select C6 down to last used row

Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=($B6=""*"")"
Selection.FormatConditions(1).Interior.ColorIndex = 4

any help would be appreciated.




Vergel Adriano

Select C6 down to last used cell, as determined in column B
 
Try something like this.

Dim lLastRow As Long
lLastRow = Sheet1.Range("B:B").SpecialCells(xlCellTypeLastCel l).Row
With Sheet1.Range("C6:C" & lLastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
Sheet1.Range("C6").Select



"BEEJAY" wrote:

Column B ALWAYS has entries in each cell.
The entries in B always go to bottom of used range on worksheet.
Once last cell is determined, need to select Column C6 down to last cell,
in order to process the following code.

' Select C6 down to last used row

Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=($B6=""*"")"
Selection.FormatConditions(1).Interior.ColorIndex = 4

any help would be appreciated.


BEEJAY

Select C6 down to last used cell, as determined in column B
 
Thanks to all, for the prompt input.
With the following modification, I got exactly what was needed.

Dim ws As Worksheet
Set ws = Worksheets("Pricing")
Dim ILastRow As Long

ILastRow = ws.Range("B:B").SpecialCells(xlCellTypeLastCell).R ow
With ws.Range("C6:C" & ILastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
ws.Range("C6").Select

Thanks Again.

"Vergel Adriano" wrote:

Try something like this.

Dim lLastRow As Long
lLastRow = Sheet1.Range("B:B").SpecialCells(xlCellTypeLastCel l).Row
With Sheet1.Range("C6:C" & lLastRow)
.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=($B6=""*"")"
.FormatConditions(1).Interior.ColorIndex = 4
End With
Sheet1.Range("C6").Select



"BEEJAY" wrote:

Column B ALWAYS has entries in each cell.
The entries in B always go to bottom of used range on worksheet.
Once last cell is determined, need to select Column C6 down to last cell,
in order to process the following code.

' Select C6 down to last used row

Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=($B6=""*"")"
Selection.FormatConditions(1).Interior.ColorIndex = 4

any help would be appreciated.



All times are GMT +1. The time now is 03:39 PM.

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