Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The Objective: A very User friendly workbook
What I have is list in every worksheet Same Design Let us say supplier#, Item# and price To make it easy for myself I used dynamic range for each What I need to do is to have a front worksheet call it Home that have a button for every supplier (or a list box),when you select a supplier Excel builtin FORM appears that let you change, add or delete any item for that supplier. The user sees only the home sheet with the form for that supplier. Now the difficult part: If a New supplier crops up, a new worksheet is created named with his code and a the SAME FORM appears to let him/her add the new data. I built the supplier sheets also a summary sheet to merge all items for easy VLookup I created the macro that merge them. Now I am faced with user friendly FORM to allow updates. I saw few samples , one I liked has the name "database" for all the work sheet list !!! Which I did not understand Appreciate your help in getting this Form VBA'd |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Arishy, You need to post the code and/or workbook as you have it, that way you will be assured of getting some help with this project! Simon -- Simon Lloyd ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708 View this thread: http://www.excelforum.com/showthread...hreadid=393555 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Simon,
You need to post the code and/or workbook For excellent reasons, the posting of attachments is actively discouraged in this NG. In any event, it would not be good advice because few in this group would be prepared to open unknown attachments. It is, in my experience, rare that the posting of relevant code together with a suitable articulation of the encounterd problem proves insufficient to enable a satifactory solution to be offered. --- Regards, Norman "Simon Lloyd" wrote in message ... Arishy, You need to post the code and/or workbook as you have it, that way you will be assured of getting some help with this project! Simon -- Simon Lloyd ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708 View this thread: http://www.excelforum.com/showthread...hreadid=393555 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You asked for Here is the difficult part: Background: There is few sheets with name SUPxx xx represent the supplier code ( always 2 digits) I need to create the following sub To do the following: - ask for new number (new supplier) yy -check it is unique ( I have a range X1-X? that containes all the existing numbers in Sheet called Home - create a new worksheet with SUPyy -Create a heading for the worksheet A1-D1 copied from sheet1 -Call the Excel Form to start inputting data at Row2 of SUPyy The Code (If you can call it that!!!): Sub AddNewSupplier() ' ' AddNewSupplier Macro ' Macro recorded 07/08/2005 by Arishy ' ' Dim newsup As String newsup = Application.InputBox("Insert a number", "This accepts numbers only", 1) 'did not code the validation yet Sheets.Add Sheets("SUP" & newsup).Select Sheets("Sheet" & newsup).Name = "SUP"&newsup Range("A1").Select Sheets("Sheet1").Select Range("A1:D1").Select Selection.Copy Sheets("SUP"&newsup).Select ActiveSheet.Paste Application.CutCopyMode = False 'The following is a key part that create a name '= "Database" 'This will insure that Excel Form knows where the database 'is ActiveWorkbook.Names.Add Name:="Database", RefersToR1C1:= _ "=OFFSET(!R1C1,0,0)" showdataform End Sub AS you will notice I used the Macro Recorder since I am very new to VBA. *** Sent via Developersdex http://www.developersdex.com *** |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Samir,
You already have a response. Here is another: '============================ Public Sub Tester() Dim RngCodes As Range Dim res As Variant Dim sh As Worksheet Dim sStr As String With Sheets("Home") Set RngCodes = _ Range(.Cells(1, "X"), .Cells(1, "X").End(xlDown)) End With Do res = Application.InputBox _ ("Enter a two-digit supplier code", Type:=2) If res = "False" Then MsgBox prompt:="You Cancelled!" Exit Sub ElseIf Len(res) < 2 Then MsgBox "A 2-digit entry is required" End If Loop Until Len(res) = 2 And IsNumeric(res) If IsError(Application.Match(res, RngCodes, 0)) Then sStr = "Supp" & CStr(res) If SheetExists(sStr) Then MsgBox "Found" 'Sheet already exists! _ 'What do you want to do?! Else Worksheets.Add.Name = sStr End If Set sh = Sheets(sStr) If Application.CountA(RngCodes(1).Resize(2)) = 0 Then 'No existing codes in Code range! Set RngCodes = Sheets("Home").Range("X1") Else Set RngCodes = RngCodes. _ Resize(RngCodes.Count + 1) End If RngCodes(RngCodes.Cells.Count).Value = sStr End If sh.Range("A1:D1").Value = _ Sheets("Sheet1").Range("A1:D1").Value With Application .DisplayAlerts = False .Goto sh.Range("A1") sh.ShowDataForm .DisplayAlerts = True End With End Sub Function SheetExists(sName As String, _ Optional ByVal wb As Workbook) As Boolean On Error Resume Next If wb Is Nothing Then Set wb = ActiveWorkbook SheetExists = CBool(Len(Sheets(sName).Name)) End Function '<<============================ --- Regards, Norman "samir arishy" wrote in message ... You asked for Here is the difficult part: Background: There is few sheets with name SUPxx xx represent the supplier code ( always 2 digits) I need to create the following sub To do the following: - ask for new number (new supplier) yy -check it is unique ( I have a range X1-X? that containes all the existing numbers in Sheet called Home - create a new worksheet with SUPyy -Create a heading for the worksheet A1-D1 copied from sheet1 -Call the Excel Form to start inputting data at Row2 of SUPyy The Code (If you can call it that!!!): Sub AddNewSupplier() ' ' AddNewSupplier Macro ' Macro recorded 07/08/2005 by Arishy ' ' Dim newsup As String newsup = Application.InputBox("Insert a number", "This accepts numbers only", 1) 'did not code the validation yet Sheets.Add Sheets("SUP" & newsup).Select Sheets("Sheet" & newsup).Name = "SUP"&newsup Range("A1").Select Sheets("Sheet1").Select Range("A1:D1").Select Selection.Copy Sheets("SUP"&newsup).Select ActiveSheet.Paste Application.CutCopyMode = False 'The following is a key part that create a name '= "Database" 'This will insure that Excel Form knows where the database 'is ActiveWorkbook.Names.Add Name:="Database", RefersToR1C1:= _ "=OFFSET(!R1C1,0,0)" showdataform End Sub AS you will notice I used the Macro Recorder since I am very new to VBA. *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking Lists and Filters between Worksheets in Excel | New Users to Excel | |||
Linking Form to worksheets excel 2007 | Excel Discussion (Misc queries) | |||
Excel 2003 - Customise a Data Form for dropdown lists | Excel Discussion (Misc queries) | |||
Direction combine several excel worksheets, drop down lists and da | Excel Worksheet Functions | |||
Form lists influencing other lists | Excel Programming |