Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-11-2018, 03:01 AM
p45cal's Avatar
p45cal p45cal is offline Excel Macro: Run-time Error '91' Windows 10 Excel Macro: Run-time Error '91' Office 2016
Expert
 
Join Date: Apr 2014
Posts: 962
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

See attached.
LBRS was Empty/Nothing at that stage in the code. I've reinstated that line.

Headers in Report B, if present, should exactly match those in Sheet1
Headers should only be on one row. There should be no duplicate headers in Sheet1.

I've copied the headers from Report B to Sheet1 but really I should have reduced the headers on Sheet1 to 1 row and re-written the code which puts the headers in Report B to match those in Sheet1. I was lazy.
You have to get the Control names exactly right in the code. Corrected.
At least now it works to a degree, over to you to add the ifs and buts, checks etc.
For instance if someone chooses None from your dropdown for the Adhesive Type, are there entries in that column with the literal string None in them?, or are you hoping to show results for when there is nothing in those cells? There's a putative line in there which you can remove if I've got this wrong.
There are a few commented-out lines of code which you might end up needing to use.
Try to avoid On Error Resume Next too much unless you know an error might be thrown and why, otherwise it hides errors while debugging.
The code:
Code:
On Error Resume Next
Set newsht = Sheets("Report B")
On Error GoTo 0
has the On Error Resume Next because the next line will always throw an error if the sheet doesn't exist, but the On Error Goto 0 returns error reporting to normal straight after.
Attached Files
File Type: xlsm msofficeforums39312.xlsm (30.2 KB, 12 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2010 Run-Time error 4198 with Insert Picture with Caption and Fram Macro jstills116 Word VBA 0 06-24-2016 07:46 AM
Help Please: New VBA user trying to use a macro to split Mail Merge documents. Two Run-Time Error zipit189 Word VBA 7 03-18-2015 01:13 PM
Excel Macro: Run-time Error '91' Shift Excel Cell after executing a macro for second time LearningMacro Excel Programming 2 01-08-2015 03:05 PM
Excel Macro: Run-time Error '91' Run Time Error 4248 when opening Word Doc from Excel CIF Excel Programming 12 02-21-2014 02:27 PM
Excel Macro: Run-time Error '91' Run-time Error 5174: Open Word Documents from Excel tinfanide Excel Programming 3 10-01-2013 07:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft