Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code for copying various cells.


Hi

I could do with some help, I have a set of values (will be 16
characters long) and they are unique to a certain code (1 code can
have
multipul values) E.g.

Code Value
111 000752
111 005894
111 007277
111 012297
111 029580
111 033820
111 046019
111 047341
111 071340
111 072354
111 112763
111 180351
113 006661
113 024007
113 030180
113 036242
113 037290
113 037591
113 037648
113 038938
113 061387
113 066591
113 073563

I need to some macro code/formula to copy and paste the value into
another
cell in a list for each Code.

E.g.

Code: 111 in cell A1
List 000752,005894,007277,etc,etc in B1

I need the values to be seperated by a comma and no spaces, they must
keep the 0's infront of the numbers though.

So basically i need to search the column with the 3digit codes in and
past
the values that are in the cell next to that code into the same cell in
a
list. I need it to do this for every code i have (about 150) with each
code
being on a seperate line

Need it to look something like below (can't get it spaced properly
though when it posts).

Column A B
Row Code List
1 111 000752,002561,007277,etc,etc
2 113 006661,024007,030180,etc,etc
3
4
5
6


Thanks in Advance


--
N1KO
------------------------------------------------------------------------
N1KO's Profile: http://www.thecodecage.com/forumz/member.php?userid=122
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=61365

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Code for copying various cells.

Maybe...

Option Explicit
Sub testme()

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

With Worksheets("Sheet1")
FirstRow = 2 'headers in row 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value Then
With .Cells(iRow - 1, "B")
.NumberFormat = "@"
.Value = .Text & "," & .Offset(1, 0).Text
End With
.Rows(iRow).Delete
End If
Next iRow
End With
End Sub




N1KO wrote:

Hi

I could do with some help, I have a set of values (will be 16
characters long) and they are unique to a certain code (1 code can
have
multipul values) E.g.

Code Value
111 000752
111 005894
111 007277
111 012297
111 029580
111 033820
111 046019
111 047341
111 071340
111 072354
111 112763
111 180351
113 006661
113 024007
113 030180
113 036242
113 037290
113 037591
113 037648
113 038938
113 061387
113 066591
113 073563

I need to some macro code/formula to copy and paste the value into
another
cell in a list for each Code.

E.g.

Code: 111 in cell A1
List 000752,005894,007277,etc,etc in B1

I need the values to be seperated by a comma and no spaces, they must
keep the 0's infront of the numbers though.

So basically i need to search the column with the 3digit codes in and
past
the values that are in the cell next to that code into the same cell in
a
list. I need it to do this for every code i have (about 150) with each
code
being on a seperate line

Need it to look something like below (can't get it spaced properly
though when it posts).

Column A B
Row Code List
1 111 000752,002561,007277,etc,etc
2 113 006661,024007,030180,etc,etc
3
4
5
6

Thanks in Advance

--
N1KO
------------------------------------------------------------------------
N1KO's Profile: http://www.thecodecage.com/forumz/member.php?userid=122
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=61365


--

Dave Peterson
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
Copying with transpose and VB code keith Excel Discussion (Misc queries) 1 November 4th 08 11:34 AM
Slow code when used as VBA code instead of macro (copying visible columns) [email protected] Excel Programming 3 April 2nd 07 05:26 PM
Copying code wal50 New Users to Excel 4 September 8th 06 08:00 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
Sheet Code Module: copying code to [email protected][_2_] Excel Programming 2 December 14th 04 01:57 AM


All times are GMT +1. The time now is 09:31 PM.

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

About Us

"It's about Microsoft Excel"