ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can somebody tell me what cause the mistake? (https://www.excelbanter.com/excel-programming/361562-can-somebody-tell-me-what-cause-mistake.html)

ericsson[_2_]

Can somebody tell me what cause the mistake?
 
Dear all experts,

I am a new comer and doing a simple database worksheet for the junior. The
first thing we need to re-define the new "size" of the database to do some
future calculations.

I write some code in workbook open to initiate the name area:

Worksheets("Inventory").Activate

maxrow = 0

maxrow = Range("a7").CurrentRegion.Rows.Count

'Range("A7").Select
Range(Cells(8, "N"), Cells(maxrow, "N")).Name = "tbl_left"
bababa....

when the junior re-open the workbook after closed, the size of the database
does not growth even junior add rows of data before close. It seems the
currentregion does not work, I've tested it in VBE by press "F8".

Can somebody tell me my mistake is in concept or in coding ?



Best Regards,

ericsson






Ivan Raiminius

Can somebody tell me what cause the mistake?
 
Hi,

probably you need something like this:

activeworkbook.names.add name:="tbl_left", refersto:= "'" & "Inventory"
& "'!" & "A8:N" worksheets("Inventory").range("a7").End(xlDown).Ro w

If I understood your question correctly.

Regards,
Ivan



All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com