ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multiple cells (https://www.excelbanter.com/excel-programming/400031-multiple-cells.html)

ssrvant

multiple cells
 
I am trying to get the following code to work for a range of cells.
Each time I put in for example Range("A1:A10").value = "whatever" the
system says that there is an error.

This is what I have so far:

Dim n
n = 1
If Range("N6").Value < n Then
Range("D6").Value = ""
Range("e6").Value = ""
End If

This what I would like to do.. something to this effect

Dim n
n=1
if range("N6:N31").Value < n then
Range("D6:D31").Value = ""
Range("E6:E31").Value = ""


Bernie Deitrick

multiple cells
 

Dim n As Integer
Dim myCell As Range
n = 1
For Each myCell In Range("N6:N31")
If myCell.Value < n Then
Cells(myCell.Row,4).Value = ""
Cells(myCell.Row,5).Value = ""
End If
Next myCell

And please don't multi-post - Crossposting is OK...
HTH,
Bernie
MS Excel MVP


"ssrvant" wrote in message
oups.com...
I am trying to get the following code to work for a range of cells.
Each time I put in for example Range("A1:A10").value = "whatever" the
system says that there is an error.

This is what I have so far:

Dim n
n = 1
If Range("N6").Value < n Then
Range("D6").Value = ""
Range("e6").Value = ""
End If

This what I would like to do.. something to this effect

Dim n
n=1
if range("N6:N31").Value < n then
Range("D6:D31").Value = ""
Range("E6:E31").Value = ""




Dave Peterson

multiple cells
 
You have another reply at one of your other posts.

ssrvant wrote:

I am trying to get the following code to work for a range of cells.
Each time I put in for example Range("A1:A10").value = "whatever" the
system says that there is an error.

This is what I have so far:

Dim n
n = 1
If Range("N6").Value < n Then
Range("D6").Value = ""
Range("e6").Value = ""
End If

This what I would like to do.. something to this effect

Dim n
n=1
if range("N6:N31").Value < n then
Range("D6:D31").Value = ""
Range("E6:E31").Value = ""


--

Dave Peterson


All times are GMT +1. The time now is 08:11 PM.

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