#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default 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 = ""

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default multiple cells

Check your other post.

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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default multiple cells

What u ned is a loop - try :

for each c in range("N6:N31")
if c<n then c.offset(0,-10)="":c.offset(0,-9)=""
next


"ssrvant" skrev:

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 = ""


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default multiple cells

hi
try something like this instead....
Sub test1()
Dim n As Single
Dim r As Range
n = 1
Set r = Range("N6:N31")
For Each cell In r
If cell.Value < n Then
cell.Offset(0, -10).Value = ""
cell.Offset(0, -9).Value = ""
End If
Next cell

End Sub


"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 = ""


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a macro to clear multiple cells from multiple worksheets? [email protected] Excel Worksheet Functions 2 October 18th 07 04:31 PM
macro copy/paste data from multiple cells to multiple cells Diana Excel Discussion (Misc queries) 0 July 10th 06 09:24 PM
Date and time stamping multiple cells for multiple entries. Gerald Excel Worksheet Functions 1 May 9th 06 01:45 PM
make multiple cells in 1 worksheet equal multiple cells in another riley454 Excel Worksheet Functions 1 January 19th 06 03:00 PM
INTRICATE PROBLEM- How to find multiple text,excluding "H", in a multiple range of cells, then replacing 0 with another number in another cell Tourcat Excel Worksheet Functions 1 February 8th 05 06:26 PM


All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"