PC Review


Reply
Thread Tools Rate Thread

Copying a cell value to a specific cells

 
 
MJKelly
Guest
Posts: n/a
 
      15th Mar 2008
Hi,

I am looping through a range of cells looking for certain criteria.
When one is reached, I want to copy the value into the next 10 cells
in the same row as the active cell in the loop. I am trying to use
the offset property to do this but cannot get it to work. Is this the
right way to approach this?

kind regards,
Matt

 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      16th Mar 2008
hi
would have been nice if you had posted your code.
but this sniplet does what you want. use it as an example.
Sub doit()
Dim r As Range
Set r = Range("A1:A10")
For Each cell In r
If cell = "x" Then 'find object
For y = 1 To 10
cell.Offset(0, y) = "x"
Next y
End If
Next cell
End Sub

regards
FSt1
"MJKelly" wrote:

> Hi,
>
> I am looping through a range of cells looking for certain criteria.
> When one is reached, I want to copy the value into the next 10 cells
> in the same row as the active cell in the loop. I am trying to use
> the offset property to do this but cannot get it to work. Is this the
> right way to approach this?
>
> kind regards,
> Matt
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying cells at a specific interval =?Utf-8?B?QU50b24gUGV0cm92?= Microsoft Excel Programming 2 31st Jan 2007 01:00 AM
Copying specific cells from a sheet to another Catalin Microsoft Excel Misc 1 28th Jul 2006 11:59 PM
Copying cells to a specific position =?Utf-8?B?TW9ydGVu?= Microsoft Excel Worksheet Functions 0 19th Oct 2004 08:19 PM
Copying specific cells ? brazen234 Microsoft Excel Misc 4 17th Jul 2004 10:19 PM
Copying block (range of cells) based on a value of a specific cell-VBA Branimir Microsoft Excel Programming 1 15th Oct 2003 06:07 PM


Features
 

Advertising
 

Newsgroups
 


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