![]() |
Can I simplify a VB code??????
Thanks Luke I shall try that. I'll let you know!
"Luke M" wrote: 'Rather than doing a copy & paste, you can tell VB directly 'that one cell equals another Private Sub Worksheet_Calculate() Application.ScreenUpdating = False With Sheets("Sheet2") .Range("J188") = .Range("J187").Value .Range("J193") = .Range("J192").Value .Range("K188") = .Range("K187").Value .Range("L188") = .Range("L187").Value End With End Sub -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "hoyos" wrote: Is there an easier way of writing this code? Private Sub Worksheet_Calculate() Application.ScreenUpdating = False Sheets("Sheet2").Range("j187").Copy Sheets("Sheet2").Range("j188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("j192").Copy Sheets("Sheet2").Range("j193").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("k187").Copy Sheets("Sheet2").Range("k188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("l187").Copy Sheets("Sheet2").Range("l188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False End Sub |
Can I simplify a VB code??????
Thanks Luke it works.
The problem I am getting now, when changing a value in one of the textboxes, takes along time to run through the calculations. Any ideas? "hoyos" wrote: Thanks Luke I shall try that. I'll let you know! "Luke M" wrote: 'Rather than doing a copy & paste, you can tell VB directly 'that one cell equals another Private Sub Worksheet_Calculate() Application.ScreenUpdating = False With Sheets("Sheet2") .Range("J188") = .Range("J187").Value .Range("J193") = .Range("J192").Value .Range("K188") = .Range("K187").Value .Range("L188") = .Range("L187").Value End With End Sub -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "hoyos" wrote: Is there an easier way of writing this code? Private Sub Worksheet_Calculate() Application.ScreenUpdating = False Sheets("Sheet2").Range("j187").Copy Sheets("Sheet2").Range("j188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("j192").Copy Sheets("Sheet2").Range("j193").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("k187").Copy Sheets("Sheet2").Range("k188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Sheets("Sheet2").Range("l187").Copy Sheets("Sheet2").Range("l188").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False End Sub |
All times are GMT +1. The time now is 12:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com