Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Repeat a task Paul Excel Discussion (Misc queries) 1 March 12th 10 11:11 PM
Task bar problem Ralphael1 New Users to Excel 2 November 18th 06 12:08 PM
How repeat a task on all files on a floppy drive ED007 Excel Discussion (Misc queries) 3 August 17th 05 03:01 PM
How do I set up a formula to repeat 5 consecutive cells in a colum jbsand1001 Excel Worksheet Functions 1 January 7th 05 05:59 PM
How do I set up a formula to repeat 5 consecutive cells in a colum jbsand1001 Excel Worksheet Functions 0 January 7th 05 05:43 PM


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

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

About Us

"It's about Microsoft Excel"