Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro to insert pair of formulae in x number of rows -URGENT!!!

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default macro to insert pair of formulae in x number of rows -URGENT!!!

Hi Marika

Try this if data in Column A does not have blank cells in it

Sub FillDown()

Range("F2:G2").AutoFill Destination:=Range("F2:G" &
Range("A1000").End(xlUp).Row)

End Sub

Watch out for word wrap above should be one line
A1000 can be changed to A10000 or 65000.
HTH

Regards,
Aussie Bob C.

"marika1981" wrote:

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro to insert pair of formulae in x number of rows -URGENT!!

Dear Bob,

Thanks SO much for your input - I really appreciate it!! The code you
offered ALMOST did the trick, but there's still one problem: it autofills all
the way down the table until the absolute last row. I'm trying to get it to
autofill down through the last blank row (basically the same number of rows
that were inserted in the previous step).

So, in a nutshell, the code needs to be adjusted so it autofills only
through the blank cells to the first cell of text in the column, not the
last. Any ideas???

Thanks again SO very much!

Marika :)


"Robert Christie" wrote:

Hi Marika

Try this if data in Column A does not have blank cells in it

Sub FillDown()

Range("F2:G2").AutoFill Destination:=Range("F2:G" &
Range("A1000").End(xlUp).Row)

End Sub

Watch out for word wrap above should be one line
A1000 can be changed to A10000 or 65000.
HTH

Regards,
Aussie Bob C.

"marika1981" wrote:

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default macro to insert pair of formulae in x number of rows -URGENT!!

Sorry Marika

i really don't understand what you are trying to do.
Where are the formulas to be placed?
Along side the inserted data only?
Where do they start and finish?
Do they stop at the start of the existing data?
What is the data layout, are both new and old 5 columns wide?
Where are the blank rows between the old and new data?
Aussie Bob C.

"marika1981" wrote:

Dear Bob,

Thanks SO much for your input - I really appreciate it!! The code you
offered ALMOST did the trick, but there's still one problem: it autofills all
the way down the table until the absolute last row. I'm trying to get it to
autofill down through the last blank row (basically the same number of rows
that were inserted in the previous step).

So, in a nutshell, the code needs to be adjusted so it autofills only
through the blank cells to the first cell of text in the column, not the
last. Any ideas???

Thanks again SO very much!

Marika :)


"Robert Christie" wrote:

Hi Marika

Try this if data in Column A does not have blank cells in it

Sub FillDown()

Range("F2:G2").AutoFill Destination:=Range("F2:G" &
Range("A1000").End(xlUp).Row)

End Sub

Watch out for word wrap above should be one line
A1000 can be changed to A10000 or 65000.
HTH

Regards,
Aussie Bob C.

"marika1981" wrote:

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro to insert pair of formulae in x number of rows -URGENT!!

Dear Bob,

Apologies for the confusion. I'm creating a spreadsheet for a non-Excel
end-user, thus trying to automate the process almost entirely. Each week,
they'll insert about 50 rows of raw data in five columns at the TOP of the
datatable using a macro i created based on InsertCopiedCells. However, in
the two columns to the right of the data there need to be two simple formulae
added after any new data is inserted, repeating the whole way down the entire
table.

So, for example, let's say columns 10-450 have five columns of data and two
columns of formulae. Then User X inserts 45 more rows of data at the top.
Now rows 10-55 have five columns of data, but no formulae in columns 6 and 7.
Starting in row 56, the rows have the seven complete columns. I'm trying to
write a macro that will highlight the range F10:G55 (though the number of new
rows each week will vary) and insert the fomulae in the blanks. ***Note, I
do have a hidden row above (row 9) that includes the formulae to better
enable autofill.

Any ideas you have would be so much appreciated!!

THANK YOU SO MUCH!!!!!

Marika :)



"Robert Christie" wrote:

Sorry Marika

i really don't understand what you are trying to do.
Where are the formulas to be placed?
Along side the inserted data only?
Where do they start and finish?
Do they stop at the start of the existing data?
What is the data layout, are both new and old 5 columns wide?
Where are the blank rows between the old and new data?
Aussie Bob C.

"marika1981" wrote:

Dear Bob,

Thanks SO much for your input - I really appreciate it!! The code you
offered ALMOST did the trick, but there's still one problem: it autofills all
the way down the table until the absolute last row. I'm trying to get it to
autofill down through the last blank row (basically the same number of rows
that were inserted in the previous step).

So, in a nutshell, the code needs to be adjusted so it autofills only
through the blank cells to the first cell of text in the column, not the
last. Any ideas???

Thanks again SO very much!

Marika :)


"Robert Christie" wrote:

Hi Marika

Try this if data in Column A does not have blank cells in it

Sub FillDown()

Range("F2:G2").AutoFill Destination:=Range("F2:G" &
Range("A1000").End(xlUp).Row)

End Sub

Watch out for word wrap above should be one line
A1000 can be changed to A10000 or 65000.
HTH

Regards,
Aussie Bob C.

"marika1981" wrote:

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to insert pair of formulae in x number of rows -URGENT!!!



"marika1981" wrote:

I've created a simple macro using "Insert Copied Cells" that copies and
pastes x number of rows of data at the top of an existing table of data. In
the table, there are five columns of data pasted in, and then two columns on
the right in which I add a pair of simple formulae (the same two formulae
repeated downwards in all rows).

I'd like these to appear automatically (via a macro) into the newly inserted
x number of rows (without knowing the value of x) after pasting in the data
in the first five columns.

Any ideas??? Is there a way to autofill down until you hit a non-blank cell
(I can insert the two formulae in the cells above the paste area)? or a way
to tell a macro to highlight downwards until it reaches a non-blank cell?

Thank you so much!!

Marika :)


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
Indirect & offset formulae - Urgent Arlette[_2_] Excel Worksheet Functions 3 June 2nd 08 11:35 PM
Insert a specified number of rows dynamically ttbbgg Excel Worksheet Functions 2 March 20th 06 08:27 PM
insert variable number of rows tina Excel Programming 1 February 9th 05 01:18 PM
Auto insert a number of rows Gar3th Excel Programming 0 January 11th 05 08:21 PM
insert 'x' number of rows??? ali Excel Programming 1 December 16th 03 09:25 PM


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