• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Run Time Error Method 'Value' of object 'Range' failed|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Run Time Error Method 'Value' of object 'Range' failed|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosRun Time Error Method 'Value' of ob…
sp_PrintTopic sp_TopicIcon
Run Time Error Method 'Value' of object 'Range' failed
Avatar
Irfan Ahmad
Member
Members
Level 0
Forum Posts: 12
Member Since:
October 24, 2017
sp_UserOfflineSmall Offline
1
October 8, 2018 - 3:31 am
sp_Permalink sp_Print

Hi All

Hope you all are doing well !

I need help to resolve the problem which i am facing. 

I used VBA userform to input data into a table name "Inv_Data" and sheet name is "Data" and use following code to find last empty row to input new record into table "Inv_Data".

Source!F2=
COUNTA(Inv_Data[ID]) .........."ID is first column of table and giving number to new records"
erow = Sheets("Source").Range("F2").Value + 1

and i am getting "run time error 2147417848 Method 'value' of object 'range' failed", after closing and reopening the file error does not appear. i don't know the reason.

please guide me how to get rid of this error.

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1518
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
October 8, 2018 - 7:57 am
sp_Permalink sp_Print

Hi Irfan,

Please supply the workbook with code+form so it is easier to help you.

Regards

Phil

Avatar
Irfan Ahmad
Member
Members
Level 0
Forum Posts: 12
Member Since:
October 24, 2017
sp_UserOfflineSmall Offline
3
October 8, 2018 - 3:18 pm
sp_Permalink sp_Print

Thanks Philip Treacy for your response.

I have attached the file, the userform which is giving error is linked with tab "Diray Punching" and i used following code to find last empty row to input new record into table "Inv_Data".

Source!F2=COUNTA(Inv_Data[ID]) .........."ID is first column of table and giving number to new records"
erow = Sheets("Source").Range("F2").Value + 1

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
4
October 8, 2018 - 5:50 pm
sp_Permalink sp_Print sp_EditHistory

Hi Irfan

I was unable to reproduce the error in Excel 2010 but it occurred in Excel 2013.

No idea why a different version should trigger this error (it crashed Excel 2013).

Tried saving your file as XLSM but it still crashed.

The code that triggered the error started from this onwards.

Sheets("Data").Range("A1").Offset(erow, 0).Value = erow

Tried changing the codes to CELLS() also did not help.

Using On Error Resume Next also caused it to crash.

Sorry, can't help you at this moment as I don't have Excel 2013 (I borrowed a copy from my colleague for earlier testing).

Sunny

Avatar
Irfan Ahmad
Member
Members
Level 0
Forum Posts: 12
Member Since:
October 24, 2017
sp_UserOfflineSmall Offline
5
October 8, 2018 - 7:29 pm
sp_Permalink sp_Print

Thanks SunnyKow !

i am using Excel 2016 and file is also crashing excel 2016.

i also tried to change my erow with following code and still same problem

erow = Worksheets("Data").Range("A1").CurrentRegion.Rows.Count

is there is any other way of writing code to get data from user form into excel?

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
6
October 9, 2018 - 10:36 am
sp_Permalink sp_Print

Hi Irfan

Try this. Hope it helps.

Sunny

Avatar
Irfan Ahmad
Member
Members
Level 0
Forum Posts: 12
Member Since:
October 24, 2017
sp_UserOfflineSmall Offline
7
October 9, 2018 - 3:42 pm
sp_Permalink sp_Print

Thanks SunnyKow for your time and efforts but still facing the same problem. i also tried following code but still the same error.

Sheet3.Cells(erow, 2) = Me.Txt_PO

and for erow following code

erow = Worksheets("Data").Range("A1").CurrentRegion.Rows.Count

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
8
October 9, 2018 - 6:38 pm
sp_Permalink sp_Print

OK. I finally got a copy of Excel 2013 to test.

Hope this time it works as I have tested it many times and it looks OK.

Sunny

Avatar
Irfan Ahmad
Member
Members
Level 0
Forum Posts: 12
Member Since:
October 24, 2017
sp_UserOfflineSmall Offline
9
October 9, 2018 - 7:29 pm
sp_Permalink sp_Print

I am using Excel 2016, and still same error. I think code should work for all version of MS Excel. 

Avatar
vasim khatik
Member
Members
Level 0
Forum Posts: 26
Member Since:
July 15, 2018
sp_UserOfflineSmall Offline
10
October 9, 2018 - 9:16 pm
sp_Permalink sp_Print

Hi Irfan

Try this. Hope it helps.

Vasim

erow = Sheets("Data").Range("F" & Rows.Count).End(xlUp).Row + 1

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
11
October 10, 2018 - 12:44 pm
sp_Permalink sp_Print sp_EditHistory

Hi Irfan

The last file I attached Finance-Diary-Inprocess3.xlsb is working fine in my Excel 2013 (32-bit).

I don't know what else I can do to resolve your problem.

If the original file is created from an older Excel version, then maybe you can try recreating the whole thing from scratch in Excel 2016.

This problem seems to be very common from what I googled and there doesn't seem to be a solution.

Even simple VBA codes that refer to range is failing. This is one reason why I am reluctant to upgrade my Excel 2010 to a newer version.

I faced numerous 32/64-bit compatibility issue, library references issues etc, all relating to using Userform. I ended up spending days converting codes to Late Binding to cater for the 64-bit issues. Codes that have been running smoothly for years can suddenly fail.

Very frustrating for a non-professional/expert programmer like me.

Hopefully some experts here can help you on your issue.

Sunny

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
12
October 10, 2018 - 1:40 pm
sp_Permalink sp_Print

Hi Irfan

I tried converting your Data table to a normal range and it seems to work. Even your original file is working.

You will need to change the Source sheet formulas in cells F1 and F2 to refer to more rows once you convert.

See if this helps.

Sunny

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Catalin Bombea, Murat Hasanoglu
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 204
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Jefferson Granemann
Glen Coulthard
Nikki Fox
Rachele Dickie
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27291

 

Member Stats:
Guest Posters: 49
Members: 31913
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.