LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default VBA code does not copy and paste to next row for each zip code

Hi, I started to learn VBA in excel and I'm trying to do the following. I
want to copy and paste a table for each 3-digit zip code (006 to 300). In
other words, I want to copy and paste the table for the first zip code (006),
and then copy and paste the same table but using the next 3-digit zip code
(007) right below the previous zip code . My VBA code is below, but it's not
working right. It does copy and paste in the same place over and over for
each zip code instead of going down to the next row and do the same trick.
Here's what I'm trying to do:

006 120
006 140
: :
006 9974
007 120
007 140
: :
007 9974
008 120

and so on

My VBA code is shown below:

Dim i As Integer
For i = 6 To 300


ActiveCell.Range("a:a").Value = i
Range("B1").Select
Sheets("Sheet2").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False


Next i

End Sub


I would appreciate any help.
Thanks


 
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
Copy and paste code Rayo K Excel Programming 1 October 12th 06 05:08 PM
copy and paste using vb code ASU Excel Discussion (Misc queries) 1 September 10th 06 01:41 AM
Got the Copy/Cut Code But what is the Paste Code Corey Excel Programming 7 July 7th 06 02:23 PM
Help-Copy&Paste code Bourbon[_30_] Excel Programming 2 January 29th 04 02:47 PM
Need Help with Code - Copy & Paste JStone0218 Excel Programming 10 October 11th 03 04:09 PM


All times are GMT +1. The time now is 08:02 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"