I've created a textbox control on a userform and I am trying to figure out how to make the text populate to a worksheet range in sequence automatically. I've figued out how to get the text that the user types in to populate in a specific range, but I'd like each entry from the user to populate on the next cell below the previous entry automatically. I've used .showdataform to do this, but I want the userform to be customized rather than using .showdataform. This is what I've been working with so far:
Private Sub TextBox1_Change ()
Dim R As Range
Dim S As String
Set R = Sheet1.Range("A 1:B10")
S = MyForm.Textbox1 .Value
R.Value = S
End Sub
Rather than having the range as A1 to B10 I'd like the text to populate in a range such as Column A and each entry from the user appear in cell A1, then A2, then A3 and so on.
5 2789
Hi
You could try somethink like this - Option Explicit
-
Dim iRow As Long
-
-
Private Sub TextBox1_Change()
-
Cells(iRow + 1, 1) = TextBox1
-
iRow = iRow + 1
-
End Sub
I'm sure this isn't the complete solution for you (for instance not sure when/where/how to reset the row counter), but it may help?
MTB
@MikeTheBike
Yes that's very close to what I'm looking for, but that solution results in a new cell choice for each character keyed in rather than for the complete textbox entry keyed in by the user. Any ideas on how to correct this?
Thank you!
dear,
I hope this will help - Private Sub CommandButton_Add_Click()
-
Range("A1").Select
-
Selection.SpecialCells(xlCellTypeLastCell).Select
-
Selection.Activate
-
ActiveCell.Offset(1, 0).Value = TextBox1.Text
-
End Sub
br,
Hi again
To do the job properly (ie a complete solution) we would need more info on the app, but this will be a little closed! - Option Explicit
-
Dim iRow As Long
-
-
Private Sub TextBox1_AfterUpdate()
-
-
Cells(iRow + 1, 1) = TextBox1
-
iRow = iRow + 1
-
-
End Sub
??
MTB
dear,
Maybe this will help You (see attachment) - Private Sub CommandButton_Add_Click()
-
Range("A1").End(xlDown).Activate
-
ActiveCell.Offset(1, 0).Value = TextBox1.Text
-
End Sub
br,
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jonny |
last post by:
Hello,
I have created a button on my form which when pressed does the
following :
1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.
However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
|
by: mail2atulmehta |
last post by:
Hi,
I do not know if this is right place for this, but i need some help. I
have a text file, whose values are seprated by a delimiter. I want to
open this file in excel, ( not import it) . I have written the driver
prg in c#. The code opens the file, but it is not writting the values
from text file into excel file. I can not figure out the problem here.
This is my code:
StreamReader dataFileReader = null;
FileInfo file = null;...
|
by: dgoel |
last post by:
Hi,
I Have a text file & I want to open it in excel sheet ( withou
importing). I have written code for it, but it is not opening exce
sheet. It opens the text file, but does not create a excel sheet
populate it. I do not know what the problem is, can someone please hel
out with this one,
Here is my code:
StreamReader dataFileReader = null;
FileInfo file = null;
Excel.Application ExcelObj = new Excel.Application();
|
by: George |
last post by:
Is there a fast way to transfer an Excel range to an array?
Example:
Excel range is E2:E300
Dim person() as string
Thanks,
George
|
by: Roy |
last post by:
Thanks for taking time to answer.I have a A2K application from which I
run series of Events by clicking few command buttons.This generates
queries,the result of which I copy and paste to worksheets in
Excel.There are 14-15 sheets which I populate manually.This I repeat
for 10-15 users.I use a Excel template which I copy and name it
according to the users and then populate.Is there a way to automate
this?I need to export these queries which...
| |
by: kath |
last post by:
How do I read an Excel file in Python?
I have found a package to read excel file, which can be used on any
platform.
http://www.lexicon.net/sjmachin/xlrd.htm
I installed and working on the examples, I found its printing of cell's
contents in a different manner.
print sh.row(rx)
|
by: akristensen |
last post by:
I am new to this site, so be patient if I do not ask the question correctly.
Current Target Platform: Browser: MS IE, script language: Javascript (will use VBScript, but JS is preferred), External apps: MS Excel
What I need to do: From a web page using javascript, I open a new Excel application and sheet, populate some information into it. After it is populated with some information, I need to run the "Solver..." option on the data in the...
|
by: Klaus Brune |
last post by:
Hello all,
When one tabs through a form (specifically, in Firefox), all the text in
a field is automatically selected.
What I'm looking for is a way to put a function (in onFocus perhaps)
that will automatically move to the END of the existing text (a blinking
cursor).
Yes, I've Googled, but cannot seem to locate just what I'm looking for.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |