473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Enter data in Excel sheet by textbox through VB coding

Hi dear friends.
Can anyone help me?
I created a VB form in Excel and a textbox and one command button. When I click the command button the text entered in the textbox will store in the empty cell range.
Of course it will show do.
But I like when I entered in the text in the textbox which already entered in the Excel sheet msgbox should show that the text already entered you cannot reenter and it should not enter the text again in sheet.
I hope that you can help me?
Sep 7 '07 #1
2 3726
kadghar
1,295 Expert 1GB
Im not quite sure i understood you, but i think this might be useful:

Expand|Select|Wrap|Line Numbers
  1. sub commandbutton1_click()
  2.  
  3. with worksheets(1).cells(1,1)
  4.     if .value<> "" then
  5.         .value = textbox1.text
  6.     else
  7.         msgbox("You cannot fill that cell twice")
  8.     end if
  9. end with
  10.  
  11. end sub
Hope that helps
Sep 7 '07 #2
QVeen72
1,445 Expert 1GB
Im not quite sure i understood you, but i think this might be useful:

Expand|Select|Wrap|Line Numbers
  1. sub commandbutton1_click()
  2.  
  3. with worksheets(1).cells(1,1)
  4.     if .value<> "" then
  5.         .value = textbox1.text
  6.     else
  7.         msgbox("You cannot fill that cell twice")
  8.     end if
  9. end with
  10.  
  11. end sub
Hope that helps
Hi Kadghar,

If condition should be Reversed:

Expand|Select|Wrap|Line Numbers
  1. sub commandbutton1_click()
  2.  
  3. with worksheets(1).cells(1,1)
  4.     if Trim(.value) =  "" then
  5.         .value = textbox1.text
  6.     else
  7.         msgbox("You cannot fill that cell twice")
  8.     end if
  9. end with
  10. end sub
  11.  
REgards
Veena
Sep 8 '07 #3

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

Similar topics

2
by: Niyazi | last post by:
Hi, I have to retrieve a data from AS400 DB2 and after working with data I have to export into one of existing Excel file. I can connect into specific library in AS400 DB2 using AS400...
9
by: sifar | last post by:
Hi, I am right now learning PHP & want to know if there is a way to send web form data to an Excel sheet located on a network. My windows xp PC doesnot have a copy of Excel. Also i am not...
1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
3
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown....
0
by: Jack | last post by:
Windows 2K Pro Access/Excel 2003 Hi there, I have a large number of password protected Excel Workbooks. The files are protected by code that runs when the workbook opens. The code asks the...
10
by: Niklas | last post by:
Hi Before I start coding I need to be sure that nobody else has not done it yet and that I can use it. I need an import utility which import data from Excel to a database or some object in...
3
by: natrajsr | last post by:
Hi, I want to load the data of a excel sheet or in the exact excel sheet format into a Rich TextBox control. I have already worked with loading WORD into a Rich TextBox. It is working fine.;...
1
by: jayafeb83 | last post by:
First I created One excel sheet, 3 rows and 3 columns and I retrieve excel data using ASP, that one I got the Answer I have to know thatretrieve from excel sheet and store the excel data in...
0
by: sivadhanekula | last post by:
Hi all, I have to do a project in excel by usung vb. The coding part is done and I am getting the output in .CSV format. when doing project in the main excel sheet I will be having 3 sheets and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.