Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Insert New Rows based on COUNTA()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TheDPQ - 28 Jan 2006 00:08 GMT
This might not be the right area however i am a newbie to Excel so
figure i'd start here. I have very limited experience with Excel s
excuse me if i don't make sense.
ANY HELP IN THE RIGHT DIRECTION WOULD BE AWESOM

I have a Column full of keywords, and i have a column full of Ad IDs..
is there a way in a *new* sheet to insert the keywords in as many time
as there are ads?

SHEET
Keyword 1 | 123
Keyword 2 | 456
xxxxxxxxx | 789

SHEET
Keyword 1 | 123
Keyword 1 | 456
Keyword 1 | 789
Keyword 2 | 123
Keyword 2 | 456
Keyword 2 | 789

I found COUNTA() Which lets me count how many keywords and ads i have
i'm just not sure what to do with those numbers now
Anne Troy - 28 Jan 2006 00:42 GMT
If I've got you right, perhaps this will help?
http://www.officearticles.com/excel/fill_in_the_blanks_in_microsoft_excel.htm
************
Hope it helps!
Anne Troy
www.OfficeArticles.com

> This might not be the right area however i am a newbie to Excel so i
> figure i'd start here. I have very limited experience with Excel so
[quoted text clipped - 20 lines]
> I found COUNTA() Which lets me count how many keywords and ads i have,
> i'm just not sure what to do with those numbers now.
Dave Peterson - 28 Jan 2006 03:07 GMT
You could use a macro:

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

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

> This might not be the right area however i am a newbie to Excel so i
> figure i'd start here. I have very limited experience with Excel so
[quoted text clipped - 26 lines]
> TheDPQ's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30915
> View this thread: http://www.excelforum.com/showthread.php?threadid=505922

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.