473,795 Members | 3,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel VBA 2003 : Populate Text on a range in sequence automatically

2 New Member
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.
Dec 21 '09 #1
5 2789
MikeTheBike
639 Recognized Expert Contributor
Hi

You could try somethink like this
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim iRow As Long
  3.  
  4. Private Sub TextBox1_Change()
  5.     Cells(iRow + 1, 1) = TextBox1
  6.     iRow = iRow + 1
  7. 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
Dec 22 '09 #2
jazznojive
2 New Member
@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!
Dec 23 '09 #3
Guido Geurs
767 Recognized Expert Contributor
dear,


I hope this will help

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton_Add_Click()
  2.    Range("A1").Select
  3.    Selection.SpecialCells(xlCellTypeLastCell).Select
  4.    Selection.Activate
  5.    ActiveCell.Offset(1, 0).Value = TextBox1.Text
  6. End Sub

br,
Dec 23 '09 #4
MikeTheBike
639 Recognized Expert Contributor
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!
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim iRow As Long
  3.  
  4. Private Sub TextBox1_AfterUpdate()
  5.  
  6.     Cells(iRow + 1, 1) = TextBox1
  7.     iRow = iRow + 1
  8.  
  9. End Sub
??

MTB
Dec 24 '09 #5
Guido Geurs
767 Recognized Expert Contributor
dear,

Maybe this will help You (see attachment)

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton_Add_Click()
  2.    Range("A1").End(xlDown).Activate
  3.    ActiveCell.Offset(1, 0).Value = TextBox1.Text
  4. End Sub
br,
Attached Files
File Type: zip add to last cell in range.zip (8.4 KB, 96 views)
Dec 24 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4088
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
1
4695
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;...
0
2869
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();
2
24462
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
3
6984
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...
12
6025
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)
3
7382
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...
3
4620
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.
0
9519
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,...
0
10215
jinu1996
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...
1
10165
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,...
0
10001
tracyyun
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...
0
6783
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();...
0
5437
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...
1
4113
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
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.