LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unable to sum range variable


I am writing a simple macro. I have programmed in years, but thi
fairly straight forward.



Dim Col As Integer
Dim col2 As Integer
Dim row As Integer
Dim dom As Integer

Dim TestRange As Range

row = 111

Col = 6

dom = Application.InputBox("What Day of the Month is it?")

col2 = Col + dom

Set TestRange = Range(Cells(row, Col), Cells(row, col2))


Range("b5").Formula = "=SUM(TestRange)"
Range("B5").Select
Selection.Copy
Range("B6:B13").Select
ActiveWindow.SmallScroll Down:=6
Range("B6:B13,B17,B18,B19,B20,B21,B21").Select
Range("B21").Activate
ActiveWindow.SmallScroll Down:=15

Range("B6:B13,B17,B18,B19,B20,B21,B21,B27,B28,B29, B30,B32,B36,B37,B38").Select
Range("B38").Activate
ActiveWindow.SmallScroll Down:=9

Range("B6:B13,B17,B18,B19,B20,B21,B21,B27,B28,B29, B30,B32,B36,B37,B38,B42")
_
Select
Range("B42").Activate
ActiveWindow.SmallScroll Down:=6
Range( _

"B6:B13,B17,B18,B19,B20,B21,B21,B27,B28,B29,B30,B3 2,B36,B37,B38,B42,B48,B49,B50,B51,B52,B53
_
).Select
Range("B53").Activate
ActiveWindow.SmallScroll Down:=15
Range( _

"B6:B13,B17,B18,B19,B20,B21,B21,B27,B28,B29,B30,B3 2,B36,B37,B38,B42,B48,B49,B50,B51,B52,B53,B61:B64, B67:B69
_
).Select
Range("B67").Activate
ActiveWindow.Zoom = 85
ActiveWindow.Zoom = 70
ActiveWindow.Zoom = 55
ActiveWindow.Zoom = 70
ActiveWindow.Zoom = 85
ActiveWindow.Zoom = 100
ActiveWindow.Zoom = 115
ActiveWindow.SmallScroll Down:=63
Range( _

"B6:B13,B17,B18,B19,B20,B21,B21,B27,B28,B29,B30,B3 2,B36,B37,B38,B42,B48,B49,B50,B51,B52,B53,B61:B64, B67:B69,B72:B75,B78:B80,B82:B83
_
).Select
Range("B82").Activate
ActiveWindow.SmallScroll Down:=-9
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-66
Range("B5").Select
End Sub


Why do i get a @name error when I try to sum my range variable?

I think the range is set properly, any help would be appreciated. I'
trying to add a dynamic range of cells. the end cell changes based o
the day.

chri

--
ckarama
-----------------------------------------------------------------------
ckaramas's Profile: http://www.excelforum.com/member.php...fo&userid=2599
View this thread: http://www.excelforum.com/showthread.php?threadid=39359

 
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
Unable to sort when column is included in range Trudy Excel Discussion (Misc queries) 1 July 8th 08 03:27 PM
Unable to Lock a Range Stuart[_5_] Excel Programming 7 July 10th 04 06:06 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Unable to set the Locked property of the range class Stuart[_5_] Excel Programming 5 June 25th 04 03:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 07:16 PM.

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

About Us

"It's about Microsoft Excel"