473,605 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.End(xlUp) not working for some cases in Excel/VBA

119 New Member
I am using the following code to find the last row that contains data, within a particular column on a spreadsheet.

Expand|Select|Wrap|Line Numbers
  1. Dim ws As Worksheet
  2. Set ws = Worksheets(Me.ChartDataSheetName)
  3. GetLastRowWithData = ws.Cells(ws.Rows.Count, dataCol).End(xlUp).row
It works for columns that contain only numbers. However, for cells that contain formulas, I get the following message:

Expand|Select|Wrap|Line Numbers
  1. Run Time Error 13
  2. Type Mismatch
This is independent of the declared type of GetLastRowWithD ata (i.e. I get the message whether it is Integer or Long). Note that it works with columns containing numbers.

Any suggestions as to why this might not be working would be appreciated!
Nov 13 '08 #1
0 2615

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

Similar topics

3
20275
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet (MyXL). It uses the worksheet's Application property to make Microsoft Excel visible, to close it, and so on. Using two API calls, the DetectExcel Sub procedure looks for Microsoft Excel, and if it is running, enters it in the Running Object Table. The...
49
14313
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
2
4874
by: charmis | last post by:
Hi everyone, I am trying to include one feature using excel object in my application. I am giving the code to create and kill the process , that i got from Microsoft site.......but nothing is happening it will create one process but , it wont close . i used the code from the link below:
2
1876
by: LBT | last post by:
Good day VB.Net seniors and experts, I have a window service application which will import data from Excel file. I face a problem where Excel.exe process cannot be released from memory once the application finish process an Excel file. I did put the code to dereference those Excel objects being created but seem like
4
4273
by: Henry Stockbridge | last post by:
Hi, I am using Access 2003 to automate an Excel workbook, but after the code completes Excel does not quit (at least it is still listed in Task Manager --Processes.) I have set a reference to the Excel 11.0 object library. I have declared my Excel variables as... Dim appExcel
1
4169
by: nur123 | last post by:
Thanks in advance who will look at it. I have been encountering an issue which I can’t find a way out of it. What my pgm does: It (java codes) reads oracle table data and creates flat text data files. Another part of the program distributes the extracted text files to unix systems. Problem first occurred: Opening those files in Unix box shows carriage return in the middle of the record as well as at the end of the record.
0
1559
by: mustaqueahmad | last post by:
Hi All, I am getting export to excel problem when I am giving IPAddress in URL, but it is working correct when am giving localhost and page name. eg : when I am writing My machine IP address and aspx pagename like 192.xxx.xxx.xx/exporttoexcell.aspx then popup page is not working. the popup page is being closed automatically , and export to excel option is not comming. for some reason when it opens within a scripted popup (js:...
3
1671
by: bnashenas1984 | last post by:
Hi everyone I'v been programming a simple task and process manager which is working fine now but the problem is that my program does NOT work on some computers. I think it must have something to do with DLL files. Actually I'm not so good at VB. I just copied some modules from internet and using them like the instruction. I post my program below maybe someone can help me fix it. Here is what I do to get the address of start menu to add...
4
2560
by: stephen | last post by:
Hi all, I am working with Excel. I read an excel document using ExcelReader and lets say it has 10 columns. I have to read each record and based on a specified column peform some activites and then write the result at the end of the record (so will have 11 columns in total) At the same time, I am performing other calculations which has to be written at the end of the file (for eg. Total records, ..., ...). Currently, I am using...
0
8004
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8425
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8288
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1271
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.