Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2022, 03:30 PM
PomDave PomDave is offline VB Error Windows 10 VB Error Office 2010
Advanced Beginner
VB Error
 
Join Date: Sep 2011
Location: Australia
Posts: 43
PomDave is on a distinguished road
Default VB Error

Hi All,



I'm trying to get my revised sheet to calculate prices and cannot see why it won't work.

My original had a macro with the following code that worked just fine:

Public Function DisneyStampListings(pRange1 As Range, pRange2 As Range) As Double
'Update 20140210
Application.Volatile
Dim rng As Range
Dim xTotal As Double
xTotal = 0
For Each rng In pRange1
If rng.Font.Color = pRange2.Font.Color Then
xTotal = xTotal + rng.Value
End If
Next
DisneyStampListings = xTotal
End Function

Now all I have done is copy the code over to my revised sheet and I get 'Expected end of statement' error which I can't resolve.

Public Fuction Disney_Stamp_Listings_2022 (pRange1 as Range, pRange2 as Range) As Double

Application.Volatile
Dim rng As Range
Dim xTotal As Double
xTotal = 0
For Each rng In Range1
If rng.Font.Color = p2Range.Font.Color Then
xTotal = xTotal + rng.Value
End If
Next
Disney_Stamp_Listings_2022 = xTotal
End Function

Any ideas
Reply With Quote
  #2  
Old 04-03-2022, 11:24 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline VB Error Windows 7 64bit VB Error Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,766
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Perhaps post in the VBA subforum instead of here?
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 04-04-2022, 07:17 AM
Debaser's Avatar
Debaser Debaser is offline VB Error Windows 7 64bit VB Error Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Typo - it's Function, not Fuction. Also, what is Range1? I think you meant pRange1
Reply With Quote
  #4  
Old 04-07-2022, 07:00 AM
croberts croberts is offline VB Error Windows 10 VB Error Office 2019
Novice
 
Join Date: Apr 2022
Posts: 12
croberts is on a distinguished road
Default

Problems highlighted in Red.

Public Function Disney_Stamp_Listings_2022 (pRange1 as Range, pRange2 as Range) As Double

Application.Volatile
Dim rng As Range
Dim xTotal As Double
xTotal = 0
For Each rng In pRange1
If rng.Font.Color = p2Range.Font.Color Then
xTotal = xTotal + rng.Value
End If
Next
Disney_Stamp_Listings_2022 = xTotal
End Function
Reply With Quote
  #5  
Old 04-07-2022, 03:18 PM
PomDave PomDave is offline VB Error Windows 10 VB Error Office 2010
Advanced Beginner
VB Error
 
Join Date: Sep 2011
Location: Australia
Posts: 43
PomDave is on a distinguished road
Default

Hi croberts,

I don't believe it, I just don't believe it!!

Debaser pointed this out before and I still didn't get it, gonna have to get my eyes tested that for sure.
Reply With Quote
  #6  
Old 04-11-2022, 02:20 AM
croberts croberts is offline VB Error Windows 10 VB Error Office 2019
Novice
 
Join Date: Apr 2022
Posts: 12
croberts is on a distinguished road
Default

No problem friend. It happens. It can happen to an aging brain, or when I'm on too many cough meds. I thought the red might help you out since I didn't see a reply from you after Debaser's reply.
Reply With Quote
  #7  
Old 04-11-2022, 03:43 AM
PomDave PomDave is offline VB Error Windows 10 VB Error Office 2010
Advanced Beginner
VB Error
 
Join Date: Sep 2011
Location: Australia
Posts: 43
PomDave is on a distinguished road
Thumbs up

Hi croberts,

Ha ha, I like it. I often go to my local chemist called Dan Murphy's for some cough medicines

Best Rgds,
Dave R.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Error error handler: inserting building blocks when multiple cells in a table are selected creates error LSLSLS Word VBA 2 01-07-2022 05:46 AM
Suddenly having trouble using .Refresh BackgroundQuery. Error 1004, General ODBC Error PLSBRYDOBOY Excel Programming 0 08-30-2019 12:17 PM
VB Error Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM
VB Error Microsoft office 2010 error 2908 and error 1935 !!!!!!heeeeellpppp!!!!!!!!! bennypryde Office 1 01-05-2012 03:33 PM
Runtime error 5487 - Word cannot complete the save to to file permission error franferns Word 0 11-25-2009 05:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:21 AM.


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