Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help with Application.WorksheetFunction

Worksheets(1).Select
With Selection
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20")
.Range("C21").Value = Application.WorksheetFunction.Sum("C17:C20")
.Range("D21").Value = Application.WorksheetFunction.Sum("D17:D20")
.Range("F21").Value = Application.WorksheetFunction.Sum("F17:F20")
End With

What am I doing wrong here. I keep getting an error on this line
..Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20").
I also get an error on ":" when I tried
..Range("B21").Value = Application.WorksheetFunction.Sum(B17:B20)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Need help with Application.WorksheetFunction

Sub hfska()
Worksheets(1).Select
With Selection
..Range("B21").Value = Application.WorksheetFunction.Sum(Range("B17:B20") )
..Range("C21").Value = Application.WorksheetFunction.Sum(Range("C17:C20") )
..Range("D21").Value = Application.WorksheetFunction.Sum(Range("D17:D20") )
..Range("F21").Value = Application.WorksheetFunction.Sum(Range("F17:F20") )
End With
End Sub

In VBA SUM() needs a real range.
--
Gary''s Student - gsnu200786


"Ayo" wrote:

Worksheets(1).Select
With Selection
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20")
.Range("C21").Value = Application.WorksheetFunction.Sum("C17:C20")
.Range("D21").Value = Application.WorksheetFunction.Sum("D17:D20")
.Range("F21").Value = Application.WorksheetFunction.Sum("F17:F20")
End With

What am I doing wrong here. I keep getting an error on this line
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20").
I also get an error on ":" when I tried
.Range("B21").Value = Application.WorksheetFunction.Sum(B17:B20)

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help with Application.WorksheetFunction

Thanks Gary's student.
I will try that.

"Gary''s Student" wrote:

Sub hfska()
Worksheets(1).Select
With Selection
.Range("B21").Value = Application.WorksheetFunction.Sum(Range("B17:B20") )
.Range("C21").Value = Application.WorksheetFunction.Sum(Range("C17:C20") )
.Range("D21").Value = Application.WorksheetFunction.Sum(Range("D17:D20") )
.Range("F21").Value = Application.WorksheetFunction.Sum(Range("F17:F20") )
End With
End Sub

In VBA SUM() needs a real range.
--
Gary''s Student - gsnu200786


"Ayo" wrote:

Worksheets(1).Select
With Selection
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20")
.Range("C21").Value = Application.WorksheetFunction.Sum("C17:C20")
.Range("D21").Value = Application.WorksheetFunction.Sum("D17:D20")
.Range("F21").Value = Application.WorksheetFunction.Sum("F17:F20")
End With

What am I doing wrong here. I keep getting an error on this line
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20").
I also get an error on ":" when I tried
.Range("B21").Value = Application.WorksheetFunction.Sum(B17:B20)

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Need help with Application.WorksheetFunction

You haven't selected anything (except a worksheet) so don't use 'With
Selection' it's simpler than that

Sub standard()
Worksheets(1).Select
Range("B21").Value = Application.WorksheetFunction.Sum(Range("B17: B20"))
Range("C21").Value = Application.WorksheetFunction.Sum(Range("C17:C20") )
Range("D21").Value = Application.WorksheetFunction.Sum(Range("D17:D20") )
Range("F21").Value = Application.WorksheetFunction.Sum(Range("F17:F20") )
End Sub

Mike

"Ayo" wrote:

Worksheets(1).Select
With Selection
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20")
.Range("C21").Value = Application.WorksheetFunction.Sum("C17:C20")
.Range("D21").Value = Application.WorksheetFunction.Sum("D17:D20")
.Range("F21").Value = Application.WorksheetFunction.Sum("F17:F20")
End With

What am I doing wrong here. I keep getting an error on this line
.Range("B21").Value = Application.WorksheetFunction.Sum("B17:B20").
I also get an error on ":" when I tried
.Range("B21").Value = Application.WorksheetFunction.Sum(B17:B20)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't use WorksheetFunction Yossi Excel Discussion (Misc queries) 5 January 25th 06 10:07 PM
Accessing WorksheetFunction.XX from regular C# Forms application Jes Ramsing Excel Worksheet Functions 1 June 16th 05 12:21 PM
WorksheetFunction Documentation P-A Caron Excel Worksheet Functions 1 April 12th 05 03:12 PM
WorksheetFunction with VBA Ghislain Marcotte Excel Discussion (Misc queries) 2 February 13th 05 07:08 AM
Application.WorksheetFunction.Match problem Carl Brehm Excel Worksheet Functions 1 January 9th 05 02:08 PM


All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"