Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA problem repeat task for each colum?
Hi
This is my first posting here, well anywhere really. Trying to teach myself all about VBA in my spare time What I want to do is get the following command to repeat in the cell below ie row 8,9 ect to row 207 Private Sub CommandButton2_Click() Dim rng As range Set rng = Sheets("Dispensary").range("f7") rng.Value = rng.Value + range("h7") range("h7") = 0 End Sub Probably really easy but cannot find how to do it anywhere. Hope someone can help Cheers Davey :confused -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA problem repeat task for each colum?
Private Sub CommandButton2_Click()
for i = 7 to 207 cells(i,"F").Value = cells(i,"F").Value + cells(i,"H").Value cells(i,"H").Value = 0 Next End Sub or Private Sub CommandButton2_Click() Dim rng as Range set rng = Range(cells(7,"F"),Cells(207,"F")) rng.offset(0,2).Copy rng.PasteSpecial xlPasteValues, _ xlPasteSpecialOperationAdd rng.offset(0,2).Value = 0 End Sub -- Regards, Tom Ogilvy "daveyscouse " wrote in message ... Hi This is my first posting here, well anywhere really. Trying to teach myself all about VBA in my spare time What I want to do is get the following command to repeat in the cells below ie row 8,9 ect to row 207 Private Sub CommandButton2_Click() Dim rng As range Set rng = Sheets("Dispensary").range("f7") rng.Value = rng.Value + range("h7") range("h7") = 0 End Sub Probably really easy but cannot find how to do it anywhere. Hope someone can help Cheers Davey --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Repeat a task | Excel Discussion (Misc queries) | |||
Task bar problem | New Users to Excel | |||
How repeat a task on all files on a floppy drive | Excel Discussion (Misc queries) | |||
How do I set up a formula to repeat 5 consecutive cells in a colum | Excel Worksheet Functions | |||
How do I set up a formula to repeat 5 consecutive cells in a colum | Excel Worksheet Functions |