Jump to content

stupidusagi

Members
  • Posts

    6
  • Joined

  • Last visited

Reputation

0 Neutral

About stupidusagi

  1. Thank you very much for your help
  2. Thank you so much! it's working! but about what you were saying, that if i want to keep the extra weeks i need to do date checking. What do you mean with that exactly?
  3. well....it's true. but I've made the changes to what you suggested accordingly. test.xlsx right now it looks like this: Sub Week_Sales() Dim Week_Sales As Integer Week_Sales = 0 Worksheets("Sheet1").Activate Column = 5 Do While Cells(4, Column) <> "" Cells(4, Column).Activate Column = Column + 1 Loop Cells(3, (Column - 14)).Activate For i = 1 To 15 If ActiveCell.Value = "Sales" Then ActiveCell.Offset(1, 0).Activate Week_Sales = Week_Sales + ActiveCell.Value ActiveCell.Offset(-1, 0).Activate End If ActiveCell.Offset(0, 1).Activate Next i ActiveSheet.Range("S4").Select ActiveCell.Value = Week_Sales End Sub
  4. Thanks! Unfortunately i get an error in Cells(2, (Column - 15)).Activate
  5. Hi Steve, Thanks for the quick reply. My excel look just like what you posted. The only problem is, and i should have mentioned this before of course, that once i'm done with a week i start a new one right after (to the right). So if i set the ActiveSheet.Range("A2").Select then it will always begin on A2..obviously, but i need it to begin on "Monday", whatever cell that is. Do you know how i might do that?
  6. Hi, I'm trying to create a custom function that will only add certain columns (the ones labeled "sales") from a certain range. However i keep getting an error message on the first ActiveCell.Offset. Can someone please tell me where the error is and how to correct the function? Function Week_Sales() v = 0 Worksheets("Sheet1").Activate For i = 1 To 15 ActiveCell.Offset(-1, -i).Activate If ActiveCell.Value = "Sales" Then ActiveCell.Offset(1, 0).Activate v = v + ActiveCell.Value End If Next i Week_Sales = v End Function Just to clear things up: my range has 15 cells, Monday - Sunday (each weekday has a column for sales and one for stock). Under Sunday I've inserted a 3rd column with total sales in the current week (Week_Sales), which is where i will be using the function. Many Thanks!
×
×
  • Create New...