Updating(Adding) new rows in a table using MACRO

ddyy

New Member
Joined
Apr 23, 2012
Messages
6
Hi,

I am trying to add new rows at the bottom of a table using a macro.

This is how I was taught before.

1. Select and copy the row.
2. go to the table to which you wish to add the new row.
3. click the top-left cell in the table and press Ctrl+downward arrow to get to the very bottom.
4. (+use relative references) Press downward arrow once again to reach the bottom blank.
5. Paste the value.

This was simple enough.

The trouble at the moment is that this macro works only if the table getting updated is not empty.
If the table is empty, the above macro will result an error.

Could you tell me how to update a new row even when the table is completely in the beginning, using macro?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
not clear

in an empty or even filled sheet the followings code takes you the last row plus one. try experiment this


cells(rows.count,"A").end(xlup).offset(1,0)
 
Upvote 0
To be clear on my issue,

#Street NameUnitCodeNameTel #RemarkCityProvincePostal Code
15 Holmes AveD Chang416-512-xxxxTorontoONM2N 4L8

<colgroup><col><col><col span="2"><col><col><col><col span="2"><col></colgroup><tbody>
</tbody>



I wish to copy and paste that row (15 Holmes...etc.) onto a separate table with the exact same headings.
#Street NameUnitCodeNameTel #RemarkCityProvincePostal Code


<colgroup><col><col><col span="2"><col><col><col><col span="2"><col></colgroup><tbody>
</tbody>



I will keep adding new rows at the bottom of that table.

Could you write me a macro? I am terribly new at Macro.
 
Upvote 0

Forum statistics

Threads
1,203,356
Messages
6,054,938
Members
444,759
Latest member
TeckTeck

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top