Can this be improved/sped up?

McLaren

Board Regular
Joined
Jul 12, 2003
Messages
122
Private Sub UserForm_Initialize()
lFrmHdl = FindWindow(vbNullString, Me.Caption)
Dim wlong As Long
wlong = GetWindowLong(lFrmHdl, GWL_EXSTYLE)
wlong = wlong And WS_SYSMENU Or WS_EX_APPWINDOW
SetWindowLong lFrmHdl, GWL_EXSTYLE, wlong
wlong = GetWindowLong(lFrmHdl, GWL_STYLE)
wlong = wlong Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
SetWindowLong lFrmHdl, GWL_STYLE, wlong
TextBox1.Value = Range("E2").Value
TextBox21.Value = Range("E15").Value
TextBox22.Value = Range("G15").Value
TextBox23.Value = Range("I15").Value
End Sub

Private Sub TextBox1_Change()
Range("E2").Value = TextBox1.Value
Range("E3").Value = TextBox2.Value
TextBox3.Value = Range("E4").Value
TextBox14.Value = Range("I4").Value
Range("E5").Value = TextBox4.Value
TextBox5.Value = Range("E6").Value
TextBox15.Value = Range("I6").Value
Range("E7").Value = TextBox6.Value
TextBox7.Value = Range("E8").Value
TextBox16.Value = Range("I8").Value
Range("E9").Value = TextBox8.Value
TextBox9.Value = Range("E10").Value
TextBox17.Value = Range("I10").Value
Range("E11").Value = TextBox10.Value
TextBox11.Value = Range("E12").Value
TextBox18.Value = Range("I12").Value
Range("E13").Value = TextBox12.Value
TextBox13.Value = Range("E14").Value
TextBox19.Value = Range("I14").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox20_Change()
Range("I2").Value = TextBox20.Value
End Sub

Private Sub TextBox21_Change()
Range("E15").Value = TextBox21.Value
End Sub

Private Sub TextBox22_Change()
Range("G15").Value = TextBox22.Value
End Sub

Private Sub TextBox23_Change()
Range("I15").Value = TextBox23.Value
End Sub

Private Sub TextBox2_Change()
TextBox2.Text = UCase(TextBox2.Text)
Range("E2").Value = TextBox1.Value
Range("E3").Value = TextBox2.Value
TextBox3.Value = Range("E4").Value
TextBox14.Value = Range("I4").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox4_Change()
TextBox4.Text = UCase(TextBox4.Text)
Range("E2").Value = TextBox1.Value
Range("E5").Value = TextBox4.Value
TextBox5.Value = Range("E6").Value
TextBox15.Value = Range("I6").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox6_Change()
TextBox6.Text = UCase(TextBox6.Text)
Range("E2").Value = TextBox1.Value
Range("E7").Value = TextBox6.Value
TextBox7.Value = Range("E8").Value
TextBox16.Value = Range("I8").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox8_Change()
TextBox8.Text = UCase(TextBox8.Text)
Range("E2").Value = TextBox1.Value
Range("E9").Value = TextBox8.Value
TextBox9.Value = Range("E10").Value
TextBox17.Value = Range("I10").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox10_Change()
TextBox10.Text = UCase(TextBox10.Text)
Range("E2").Value = TextBox1.Value
Range("E11").Value = TextBox10.Value
TextBox11.Value = Range("E12").Value
TextBox18.Value = Range("I12").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub TextBox12_Change()
TextBox12.Text = UCase(TextBox12.Text)
Range("E2").Value = TextBox1.Value
Range("E13").Value = TextBox12.Value
TextBox13.Value = Range("E14").Value
TextBox19.Value = Range("I14").Value
TextBox1.Value = Range("I20").Value
End Sub

Private Sub CommandButton1_Click()
Dim appWD As Word.Application
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = False
Sheets("Calculator").Select
Sheets("Template").Range("A10").Value = Range("J2").Value
Sheets("Template").Range("A11").Value = Range("J3").Value
Sheets("Template").Range("A14").Value = Range("J4").Value
Sheets("Template").Range("A18").Value = Range("J5").Value
Sheets("Template").Range("A21").Value = Range("J6").Value
Sheets("Template").Range("A22").Value = Range("J7").Value
Sheets("Template").Range("A24").Value = Range("J8").Value
Sheets("Template").Range("A26").Value = Range("J9").Value
Sheets("Template").Range("A28").Value = Range("J10").Value
Sheets("Template").Range("A30").Value = Range("J11").Value
Sheets("Template").Range("A32").Value = Range("J12").Value
Sheets("Template").Select
Range("A1:A103").Copy
appWD.Documents.Add
appWD.Selection.Paste
appWD.ActiveDocument.SaveAs Filename:="G:\Fadal\BRAD\Temp.doc"
appWD.ActiveDocument.Close
appWD.Quit
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Quit
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Yuck, sorry that came out so badly. Basically I have 23 textboxes that all interact with each other(data from one could modify 13 others), and when that happens it could take as long as 3 seconds to update everything. Am I doing everything as simply as possible, or should I have wrote it a different way?
Thanks in advance for any and all replies.
 
Upvote 0
Engrave Width Six String.xls
ABCDEFGHI
2CHARACTER HEIGHT0.06PART DIAMETER1.5
3ENGRAVING STRING #1THIS
4STRING #1 FULL WIDTH0.202STRING #1 HALF WIDTH0.101
5ENGRAVING STRING #2IS
6STRING #2 FULL WIDTH0.086STRING #2 HALF WIDTH0.043
7ENGRAVING STRING #3A
8STRING #3 FULL WIDTH0.063STRING #3 HALF WIDTH0.032
9ENGRAVING STRING #4TEST
10STRING #4 FULL WIDTH0.226STRING #4 HALF WIDTH0.113
11ENGRAVING STRING #5THANK
12STRING #5 FULL WIDTH0.297STRING #5 HALF WIDTH0.149
13ENGRAVING STRING #6YOU
14STRING #6 FULL WIDTH0.181STRING #6 HALF WIDTH0.09
15Total L1.38Left L0Right L0
16ENGRAVE STRING #1 TABLE9.1673
17WIDTH#TOTALSTARTENDVALUEVALUE0.541
18A1.0506000.22790.2279003.8197
19B0.9455000.22790.1284000
20C0.9471000.18370.2677000.06
Calculator
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,266
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top