Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Help. Looping, code change.


I need to get sheet 1 http://www.thedpq.com/excel_01.gif to look lik
sheet 2 http://www.thedpq.com/excel_02.gif

I basically have a list of keywords, ad ids, and urls. I need B to b
listed as many times as there are items in E. A,D,F,G are sort o
filler data that needs to be used to make it look like sheet 2.
http://www.thedpq.com/excel_02.gif

Someone gave me the following code which i don't know enough to chang
it to get it to what i need.

The code would be if A was a list of keywords and B was a list of a
IDs. Its doing half the work already.


Option Explicit
Sub testme()
Dim myCol1 As Range
Dim myCol2 As Range
Dim myCell1 As Range
Dim myCell2 As Range
Dim wks As Worksheet
Dim newWks As Worksheet
Dim oRow As Long

Set wks = Worksheets("Sheet1")

With wks
Set myCol1 = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
Set myCol2 = .Range("b1", .Cells(.Rows.Count, "B").End(xlUp))
If myCol1.Cells.Count * myCol2.Cells.Count .Rows.Count Then
MsgBox "Too much data!"
Exit Sub
End If
End With

Set newWks = Worksheets.Add

oRow = 0
For Each myCell1 In myCol1.Cells
For Each myCell2 In myCol2.Cells
oRow = oRow + 1
With newWks.Cells(oRow, "A")
.Value = myCell1.Value
.Offset(0, 1).Value = myCell2.Value
End With
Next myCell2
Next myCell1

End Sub



--
TheDP
-----------------------------------------------------------------------
TheDPQ's Profile: http://www.excelforum.com/member.php...fo&userid=3091
View this thread: http://www.excelforum.com/showthread.php?threadid=50642

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Help. Looping, code change.


Wow ok i figured out more of that then i thought. I cheated and had
lot of the stuff hard coded in the loop since it won't change. I jus
need to be able to bring the URL into the loop.

Updated post

--
TheDP
-----------------------------------------------------------------------
TheDPQ's Profile: http://www.excelforum.com/member.php...fo&userid=3091
View this thread: http://www.excelforum.com/showthread.php?threadid=50642

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
Change a specific code to generic in VB macro Sue Excel Discussion (Misc queries) 2 April 23rd 08 06:56 PM
Macro code to change tab name TurboBeagle Excel Programming 1 July 5th 05 11:20 PM
Looping code in Excel macro Robert Excel Programming 2 February 25th 05 04:33 AM
Can You Change A CommandButton Code Using A Macro? Donna[_7_] Excel Programming 4 February 11th 05 08:38 AM
Code looping when it should not Todd Huttenstine Excel Programming 3 May 13th 04 09:37 PM


All times are GMT +1. The time now is 02:04 AM.

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"