A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hopefully a real easy vba question



 
 
Thread Tools Display Modes
  #1  
Old November 17th, 2009, 04:46 PM posted to microsoft.public.excel.misc
Brad
external usenet poster
 
Posts: 943
Default Hopefully a real easy vba question

The line with activecell.formula is not correct. What I'm trying to do is to
add up the time for person 1-16 on the total page if the date isn't a holiday.

Sub TotalThemUp()
Dim i As Long
Dim j As Long
Range("startpoint").Select
Range("B11:AF22").ClearContents
For i = 1 To 12
For j = 1 To 31
If ActiveCell.Offset(i, j) "H" Then
ActiveCell.Formula&"R"&i&"C"&j =
"=sum(Person1:Person16!)"&"R"&i&"C"&j
End If
Next j
Next i
End Sub
  #2  
Old November 17th, 2009, 05:55 PM posted to microsoft.public.excel.misc
Luke M
external usenet poster
 
Posts: 2,672
Default Hopefully a real easy vba question

I believe you are wanting multiple formulas as an output in the range of
B11:AF22?
Corrected syntax:

Sub TotalThemUp()
Dim i As Long
Dim j As Long
Range("startpoint").Select
Range("B11:AF22").ClearContents
For i = 0 To 11
For j = 0 To 30
If ActiveCell.Offset(i, j) "H" Then
ActiveCell.Offset(i, j).FormulaR1C1 = _
"=sum(Person1:Person16!R" & i & "C" & j & ")"
End If
Next j
Next i
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Brad" wrote:

The line with activecell.formula is not correct. What I'm trying to do is to
add up the time for person 1-16 on the total page if the date isn't a holiday.

Sub TotalThemUp()
Dim i As Long
Dim j As Long
Range("startpoint").Select
Range("B11:AF22").ClearContents
For i = 1 To 12
For j = 1 To 31
If ActiveCell.Offset(i, j) "H" Then
ActiveCell.Formula&"R"&i&"C"&j =
"=sum(Person1:Person16!)"&"R"&i&"C"&j
End If
Next j
Next i
End Sub

  #3  
Old November 18th, 2009, 09:50 PM posted to microsoft.public.excel.misc
Brad
external usenet poster
 
Posts: 943
Default Hopefully a real easy vba question

Thanks - so close

Thanks for providing an example on the format to use. Made the necessary
adjustment and got what I needed....

Thanks again!!

"Luke M" wrote:

I believe you are wanting multiple formulas as an output in the range of
B11:AF22?
Corrected syntax:

Sub TotalThemUp()
Dim i As Long
Dim j As Long
Range("startpoint").Select
Range("B11:AF22").ClearContents
For i = 0 To 11
For j = 0 To 30
If ActiveCell.Offset(i, j) "H" Then
ActiveCell.Offset(i, j).FormulaR1C1 = _
"=sum(Person1:Person16!R" & i & "C" & j & ")"
End If
Next j
Next i
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Brad" wrote:

The line with activecell.formula is not correct. What I'm trying to do is to
add up the time for person 1-16 on the total page if the date isn't a holiday.

Sub TotalThemUp()
Dim i As Long
Dim j As Long
Range("startpoint").Select
Range("B11:AF22").ClearContents
For i = 1 To 12
For j = 1 To 31
If ActiveCell.Offset(i, j) "H" Then
ActiveCell.Formula&"R"&i&"C"&j =
"=sum(Person1:Person16!)"&"R"&i&"C"&j
End If
Next j
Next i
End Sub

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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