PC Review


Reply
Thread Tools Rate Thread

Add a constant value to a range of cells during a copy macro

 
 
Kurt Barr
Guest
Posts: n/a
 
      26th Jun 2008
Ok,

I've got one worksheet that I'm trying to convert to a new worksheet, and
one of the values that I'm converting is changing from a 3 character code to
a 6 character code. The 3 new characters ("F00") that I'm adding are the same
for every value that I'm coverting in that column, and they are added to the
front of the string.

Is there a way to add the new characters as I paste the value during the
conversion, or do I need to try and program a loop to do this for me?
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      26th Jun 2008
After your copy, select the cells you want to change and:

Sub updatee()
For Each r In Selection
r.Value = "FOO" & r.Value
Next
End Sub

--
Gary''s Student - gsnu200793


"Kurt Barr" wrote:

> Ok,
>
> I've got one worksheet that I'm trying to convert to a new worksheet, and
> one of the values that I'm converting is changing from a 3 character code to
> a 6 character code. The 3 new characters ("F00") that I'm adding are the same
> for every value that I'm coverting in that column, and they are added to the
> front of the string.
>
> Is there a way to add the new characters as I paste the value during the
> conversion, or do I need to try and program a loop to do this for me?

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      26th Jun 2008
It would be really helpful to see the code you have. I can assume you want
something like this below. This code assumes all the cells you want changed
are in Col. A.

Sub CopyCells()

Dim i As Long
Const c As String = "F00"

For i = 1 To 10
Sheets("Sheet2").Cells(i, 1) = c & Sheets("Sheet1").Cells(i, 1)
Next i

End Sub

Hope this helps!
--
Cheers,
Ryan


"Kurt Barr" wrote:

> Ok,
>
> I've got one worksheet that I'm trying to convert to a new worksheet, and
> one of the values that I'm converting is changing from a 3 character code to
> a 6 character code. The 3 new characters ("F00") that I'm adding are the same
> for every value that I'm coverting in that column, and they are added to the
> front of the string.
>
> Is there a way to add the new characters as I paste the value during the
> conversion, or do I need to try and program a loop to do this for me?

 
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
Need Macro copy range of cells Duane Reynolds 322310 Microsoft Excel Programming 5 27th Mar 2009 06:08 PM
Macro to copy range of cells and paste into 1 sheet Dean Microsoft Excel Programming 2 20th Feb 2006 12:53 AM
Use macro to check a range of cells within a row and copy wanted data to new sheet busspeed Microsoft Excel Programming 1 29th Sep 2004 03:59 PM
Use macro to check a range of cells within a row and copy wanted data to new sheet busspeed Microsoft Excel Programming 0 29th Sep 2004 03:15 PM
Use macro to check a range of cells within a row and copy wanted data to new sheet busspeed Microsoft Excel Programming 2 29th Sep 2004 02:55 PM


Features
 

Advertising
 

Newsgroups
 


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