I have a coding to calculate No. of x and y dies (it's actually column and row). How do I insert the coding into the UserForm to make it works? Then, after I key in the data for each x and y dies and press "Ok", I want the output to appear on my worksheet. What coding do I use for the "Ok" part? And for the "Cancel" part as well. I'm still new to VBA code.
My code:
Sub InsertShapeRange()
Dim my_row As Integer
Dim my_col As Integer
Dim Rng As Range
Dim shp As Shape
Dim ws As Worksheet
my_col = Application.InputBox("No. of x dies?", "Wafer Map", Default:=0)
my_row = Application.InputBox("No. of y dies?", "Wafer Map", Default:=0)
Set Rng = Selection
Set Rng = Rng.Resize(my_row, my_col)
Set ws = Rng.Parent
Set shp = ws.Shapes.AddShape(1, Rng.Left, Rng.Top, Rng.Width, Rng.Height)
With shp
.Fill.Visible = msoFalse
With .Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
End With
End With
With Rng
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideVertical).LineStyle = xlContinuous
End With
End Sub
I have a UserForm as shown below.
Capture.JPG
https://stackoverflow.com/questions/...ro-to-userform
Bookmarks