vba coding for excel.....

ZakiZelani

Honorable
May 20, 2014
45
0
10,530
anyone here know how to create a code in a way that when i click the button. it will copy the whole table and paste the the next sheet.


the thing is that, the first table is always updated. so i need to ensure that the code is copying the whole table even after i keep inserting in that row.


anyone can help please
 
Solution
Sheets("all items list").Range("b8:f47") needs to read Sheets("all items list").Range("your range name")

Your range name needs to be a dynamic named range which automatically expands with the size of the table.
It is a feature in excel
Google how to do it.

lodders

Admirable
Your table needs to be a dynamic named range. There are various types, suggest you Google it
Then your vba code just copies the range - one line of code.
I generally record a copy paste macro, then edit it within excel
 

ZakiZelani

Honorable
May 20, 2014
45
0
10,530


yes, i found a code however when i insert new row of data it didnot copy the whole table, it just copy the range i put in the code.

the code is :


Sub updatetable()

Sheets("all items list").Range("b8:f47").Copy Destination:=Sheets("iventory").Range("c4")


Application.CutCopyMode = False

End Sub


are you able to edit the code for me?
 

USAFRet

Titan
Moderator


Change the parameters for your Range
 

ZakiZelani

Honorable
May 20, 2014
45
0
10,530


can i put it as "table 1"? but its not the whole information that i want to copy from table. on top of that, i cant be changing the parameter evertime i insert new row. you get what i mean?
 

lodders

Admirable
Sheets("all items list").Range("b8:f47") needs to read Sheets("all items list").Range("your range name")

Your range name needs to be a dynamic named range which automatically expands with the size of the table.
It is a feature in excel
Google how to do it.
 
Solution

ZakiZelani

Honorable
May 20, 2014
45
0
10,530


im able to do it, thanks :)