Textbox value to cell in active sheet rather then Specific

DanSMT

Board Regular
Joined
Sep 13, 2019
Messages
203
Office Version
  1. 2013
Platform
  1. Windows
Hey all new here.

I am having an issue changing code to place textbox value to current active sheet rather than a specific sheet. I am working my way through to create an active form to generate data based on scanning an item into a single textbox.

TextBox1.Font.Size = 28
TextBox1.Value = ActiveSheet.Range("E1").Value + 1
If Me.ScanTB = "" Then
Me.ScanTB.SetFocus
Else
For i = 1 To 1
c = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row 'Having issue here.
Sheets("Sheet1").Cells(c + 1, 1).Value = ScanTB.Text
Next i
Me.ScanTB = ""
Cancel = True
End If
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi & welcome to MrExcel
How about
Code:
If Me.ScanTB = "" Then
   Me.ScanTB.SetFocus
Else
   Cells(Rows.Count, 1).End(xlUp).Offset(1).Value = ScanTB.Text
   Me.ScanTB = ""
   Cancel = True
End If
 
Upvote 0
One more thing.

I would also like to count each item in the first column and display the quantity in a textbox.

I did that in the first spreadsheet, however when I create a new sheet it obviously isnt transfering over.
 
Upvote 0
As that is a totally different question, please star a new thread.
Cheers
 
Upvote 0
Ok, although I actually figured that one out. Thanks though.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,630
Messages
6,173,451
Members
452,514
Latest member
cjkelly15

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