Archive for November, 2008
Restrict entry into Textbox Control
When you are working with a userform to create a userinterface for data input, sometimes you would like to restrict the users to input numbers only in some of the textbox controls. However, many a times you would find accidently or otherwise, you find text entered into the database. You can use the following code to make sure that anything typed in textbox1 other than numbers 0 – 9 will not be accepted. Thus you can successfully implement to reduce errors in your database.
|
Private Sub TextBox1_KeyPress( _ ByVal KeyAscii As MSForms.ReturnInteger) ‘ This code restricts any text in textbox1 other than ‘ integer 0 – 9 …. Select Case KeyAscii Case Asc(“0″) To Asc(“9″) Case Else KeyAscii = 0 End Select End Sub |
Consolidating Data from >20 workbooks, each workbook Containing >70 worksheets
- Selva V Pasupathy, HSBC Global Resourcing, Hyderabad
|
Option Explicit ‘___________________________________________________________________________ ‘*************************************************************************** ‘* ‘* MODULE NAME: Copy Data from all Excel Files in a Folder ‘* AUTHOR: Selva V Pasupathy, HSBC Global Resourcing, Hyderabad ‘* ‘* CONTACT: socko@rediffmail.com ‘* WEB SITE: http://socko.wordpress.com ‘* ‘* DESCRIPTION: The following visual basic code was written when ‘* I wanted to consolidate the data from 26 workbooks ‘* and in each workbook, there were are 77 sheets. It ‘* would have been a very difficult task, if I had to ‘* do it manually. I believe this procedure will be ‘* useful to somebody else ‘* NOTES: ‘* Before using the codes, you can change all the variables like, ‘* Folder, File , SearchString, SearchSubfolders (true / false), ‘* and other variables. ‘*———————————————————————— ‘* Other Information ‘* ‘* UPDATES: ‘* DATE COMMENTS ‘* 16 Nov 2008 You are free to use , change, and modify this code. ‘___________________________________________________________________________ ‘*************************************************************************** Function ListFiles(sCount As Integer, ByVal sFldr As String, _ With Application.FileSearch End Function Sub Consolidate_Data() myFolder = “J:\GB Project\CONSOLIDATED” With ThisWorkbook.Sheets(“data”) |
Archives
- ActiveX Programming
- Add an Image to Cell Comments
- Add Sheet Navigation CommandBar to an Excel file or Application
- Auto-Generate a File Name
- Automate File Download from Internet
- Automate WebLogin…
- Convert Decimal to RGB Color Value
- Copy Ranges from Different Sheets into one Sheet
- Create HyperlinkObject on Sheet
- Create LogFile for Workbook Open
- Create Sheet “Table of Contents”
- Create ShortCut Link at the desired location
- Create UserForm at Runtime using Code
- Display Userform with no Title Bar (Splash Screen)
- Downloads
- Downloads from www.jkp-ads.com
- Export a Text File with Comma and Quote Delimiters
- Get elements from HTML form
- Get FileName with Path from User
- Get FileNames with Path from User
- Hyperlink Elements in HTML
- Ken’s Knowledge Base submissions
- Login to Rediffmail
- Move a File
- Multiple Cell Concatenation
- Other Site Links
- Read CSV Using VBA techniques
- Remove Unprintable Character & Spaces from cells
- Rename a File
- Rename Files using Codes (VBA)
- Resources
- Resources
- Search Folders and Subfolders for files
- Show Status on Userform While executing Code
- Site Contents
- socko.wordpress.com — Technorati Search
- Sort WorkSheets by Name
- Sorting Text with Worksheet Formula
- test
- Use of vbScript in Database Applications
- Userform Resizer – VBA
- Userforms
- VBA Code Library
- vbaX KB Links
- Verify that a File Exists
- Web Forms manipulated by Visual Basic
- Write to & Read from Sequential Text Files