View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Converting strings to Sum worksheet function and control variables

Dim range1 as range
Dim ws as String
ws = "Sheet1"
set range1 = worksheets(WS).range("B91:B" & g)
MsgBox Application.WorksheetFunction.Sum(Range1)

or

Dim range1 as Range
Dim ws as Worksheet
set ws = Worksheets("Sheet1")
set range1 = WS.range("B91:B" & g)
MsgBox Application.WorksheetFunction.Sum(Range1)

--
Regards,
Tom Ogilvy


"Spammastergrand" wrote in message
...

WS is a variable not a sheet name. I don;t want to hard code the sheet

name
since they'll be working with various months like Jan Feb, etc