Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ng,
I have the following code: ""Private Sub CommandButton1_Click() Dim bClose As Boolean Dim bk As Workbook On Error Resume Next Set bk = Workbooks("prisliste.xls") On Error GoTo 0 If bk Is Nothing Then bClose = True Set bk = Workbooks.Open("C:\prisliste udskrift\prisliste.xls") End If bk.Worksheets(1).Range("F14").Value = _ Worksheets(2).Range("G38").Value + Worksheets(2).Range("G41").Value bk.Save If bClose Then bk.Close Savechanges:=False End If Application.EnableEvents = False ThisWorkbook.Save Application.EnableEvents = True End Sub"" Now i need to add another cell so it goes something like this: ""Worksheets(2).Range("G38").Value + Worksheets(2).Range("G41").Value + Worksheets(2).Range("G41").Value"" Cell G41 needs to be + 2 times and it works fine, but i have to do it on G41 to P41 and next time cell G41 needs to be + 3 times (G41 to P41), this goes one up to 9 times. And what im thinking is that, thats alot of code and WORK :-) is there not a easier way to do this ? Regards, Ole |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
When entering data into a range of cells, select the entire range. | Excel Discussion (Misc queries) | |||
how to compute a range of cells based on another range of cells? | Excel Worksheet Functions | |||
how to compute a range of cells based on another range of cells? | Excel Worksheet Functions | |||
Count cells in one range based on parameters in another range | Excel Worksheet Functions | |||
Copy a formula to a range of cells via VB6 using .Range(Cells(row,col), Cells(row,col)).Formula= statement | Excel Programming |