Anyone can help me with vba

jovie

Board Regular
Joined
Nov 13, 2015
Messages
68
I was trying to input the code number and then copy the data from another worksheet with same code number
However, after I try this code, it shows type mismatch at
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Integer
Dim rg As Range
Dim n As Long, count As Integer
If Target.Row > 1 And Target.Column = 1 Then
c = InputBox("Please enter the quantity.", "Stock Out")
n = Sheets("Master chart").Range("a65535").Row
Set sh = Sheets("Master Chart")
For i = 8 To n
If sh.Cells(i, 25) = Sheet5.Columns(1) Then
Application.SendKeys "{Enter}"
count = count + 1
Set rg = sh.Range("B" & i & ":D" & i)
rg.Copy Sheets("Stock Out").Range("A" & (count + 2))
Sheet5.Columns(4).Value = c
End If
Next
End If

End Sub
I don't understand where is wrong, so anyone willing to help me?
And I was try to input the "c", in to one column in another workbook(refer to different code)
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
But Now I meet another problem.....
Sub StockOut_Button1_Click()
Dim a As String
Dim b As Integer
Dim c As String
n = Range("a65535").End(xlUp).Row
For i = 2 To n
If IsEmpty(Cells(i, "A")) Then
a = InputBox("Please Enter the MM code ", "Search", a)
Cells(i, "A").Value = a
b = InputBox("Please Enter the Quantity ", "Quantity", b)
Cells(i, "B").Value = b
c = InputBox("Please Enter your Employ.No ", "Employ.No", c)
Cells(i, "C").Value = c
End If
GoTo 1
Next i
1: End Sub
I write this code to input this data, but it no reaction when I click the button
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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