View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Automatically populating cells down a row

Good deal...........

Gord

On Sun, 3 Jun 2012 05:26:18 +0000, erstaples
wrote:


I figured it out, Gord. It turns out that the solution was really really
simple.

I did a Do Until... Or


Code:
--------------------

trends_counter = 7
Do Until Trends.Sheets("sheet1").Cells(trends_counter, 1).Value = ThisWorkbook.Sheets("komori").Range("JobNumber").V alue Or Trends.Sheets("sheet1").Cells(trends_counter, 1).Value = ""
trends_counter = trends_counter + 1

Loop


ThisWorkbook.Sheets("komori").Range("JobNumber").C opy
Trends.Sheets("sheet1").Range("A" & trends_counter).PasteSpecial xlPasteAll
ThisWorkbook.Sheets("komori").Range("JobSpecs").Co py
Trends.Sheets("sheet1").Range("B" & trends_counter).PasteSpecial xlPasteAll


Trends.Save
Trends.Close


--------------------


What this does is the counter in the second book first looks for the job
number. If the counter finds the job number it stops there and any new
job specs from the first workbook will update down the row. If the
counter doesn't find the job number it goes to the first empty cell and
the new job & job specs are copy/pasted from the first workbook.

I'm learning as I go here. If there's a simpler or more efficient way of
doing this I'd love to hear it, but I've tested this and it does what I
need it to do...