473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Excel 2003 - Dynamic named ranges

47
I am making mistake and I can’t understand what I am doing wrong.
Dynamic named ranges is what I was busy with in Excel 2003.

This is practical problem:

In worksheet `A` I have data in column O.

I need last value (and last value will change) from column O to display in another worksheet (`B`) in cell A634.

This is what I did in for column O in `A`:

Insert>Name>Define

I’ve typed “range” in Name in workbook, while I’ve typed into Refers to the following:

=OFFSET($O$4,0,0,COUNTA($O$4:$O610),1)

As of now last value in O column is in O599, with column work area being extended down to O610 and before O610 is reached I will be expanding column by adding extra 10 rows. (Insert>Row)

If this is correct and if this means that range in O will extend as I add more rows with new data – What I need to type in cell A634 in another workbook in order to have last value from O column displayed? (after each addition of new data and rows and calculations in O)

Thank you in advance.
Feb 17 '10 #1
2 2320
TheSmileyCoder
2,322 Expert Mod 2GB
Well this is what I could come up with.
Add a module, and add this code to the module
Expand|Select|Wrap|Line Numbers
  1. Public Function LastValue(strCol As String)
  2.  
  3.     Dim intI As Integer
  4.     intI = 1
  5.     Do While Sheet1.Range(strCol & intI + 1) & "" <> ""
  6.         intI = intI + 1
  7.     Loop
  8.     LastValue = Sheet1.Range(strCol & intI)
  9.     Debug.Print LastValue
  10. End Function
This function will run through all the values in the column strCol given as input parameter, until it reaches a empty cell, at which point it will return the value of hte previous cell.


In your worksheet, in cell A634 put in the function:
LastValue("O") where "O" is your column name.

In worksheet A, add code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2.     Sheet1.Range("A" & 634).Dirty
  3. End Sub
Making the cell re-evaluate whenver you change something. You could probably limit it to only evaluate if the Target is an item in column O.
Feb 18 '10 #2
bcr123
47
Thank you very much TheSmileyOne.

Will try to work it out.

Appreciated.
Feb 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bertrand | last post by:
Hello, I am trying to archieve the following: - copy an excel file present on the server - insert values into named ranges of the copy I am using Excel97 on my PC, the server does not have...
6
by: Andrew | last post by:
Hi, How can I make a connection to an Excel file, and I can select the specific fields? For example in sheet1: A B C 1 20 change good 2 short return ...
9
by: Julie Miles | last post by:
I need to pull several tables of data from Excel into a web page, but when I use Excel's "Save as web page" function, I get an enormous file containing a massive amount of css formatting. I'd like...
0
by: JS | last post by:
Here is something weird that is happening to me and I just cannot seem to fix this problem: I have built an application that does a data dump into Excel and then creates named ranges so that the...
1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
3
by: Conrad F | last post by:
Hello All, I know how to import a specific named excel sheet into a datagrid using ADO.NET by setting up a JET connection and then SELECTing data from the sheet. However, for a real world...
4
by: Lisa | last post by:
Hi - I'm able to open excel workbooks and word documents, but I can't seem to copy excel charts, named ranges, etc. to a word document. Anyone know of good reference material in this area? What...
6
by: Gunawan | last post by:
Dear All, I have create an excel (COM Object) using this code Excel.Application xls = new Excel.Application(); but I can not remove it from memory although I have using close and quit ...
3
by: D.Stone | last post by:
I'm trying to import an Excel spreadsheet into an existing Access table using Office 2003. Ultimately, the plan is to do it programmatically using TransferSpreadsheet, but to check that the file...
4
by: laurasesma18 | last post by:
I've got a convertion tool with Access 2003. It imports an excel sheet into the data base and with the records in it creats different outputfiles. Its programmed with VBA. Now what I need is, in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.