+ Reply to Thread
Results 1 to 5 of 5

VBA to Insert row & data from user form in list

Hybrid View

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA to Insert row & data from user form in list

    I'm trying to take on a project to help one of drilling guys to simplify inputting his casing tally's on the rig. He's completely Excel handicapped and I know just enough to be dangerous. I know it's fairly simple I just can't seem to put all the parts of code together and get it to work nor do I know what to fix when it doesn't. What happens is that as the pipe is received it's measured among other things and those measurements or Tally is kept in a spreadsheet similar to that attached. I created a VERY basic mock tally to test any script I could find. Once the pipe is ready to put in the well certain attachments may be added within the string that is numbered in the left column. Also some pipe may be kicked out (has X in right column) for one reason or another so it's length is not counted in the tally. What I would like to happen is that when you want to add a casing attachment you click the radio button and it brings up the user form I built. On the form the first box should contain a drop down list of the attachments (float collar, float shoe. etc). Then the form asks for it's length. Then finally where do you want to put it between joint # x & y found in column A. When you hit insert attachment it should create a row between joints X & Y in column A that you designated. Put the name of the attachment in col A of the newly created row, then put the length in Col B of the new row. It would be nice if it automatically recalculated the depths with the new attachment and kicking out any with an X, but if I need to add another "Recalculate" radio button to do this it's not a problem.
    Attached Files Attached Files
    Last edited by CajunAg; 09-23-2013 at 11:59 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    VBA Help for Novice on Work Project

    Hi there,

    Take a look at the attached modified version of your workbook and see if it does what you want.

    A few points:

    I've included a SUMIF formula to calculate the total lengths of all components not flagged with "x" in Column D

    Instead of using the UserForm to specify the Attachment as being inserted between Joint X and Joint Y, the User selects the cell containing Joint X in Column A of the "Tally" worksheet (before displaying the UserForm), and the Attachment is automatically inserted on the row immediately underneath the selected cell.

    The list of Casing Attachment names is specified in a table located on the "Attachments" worksheet - you should not leave any blank rows between these names. These names will be displayed in the dropdown list of the ComboBox on the UserForm. Up to 20 names may be inserted - if you need more, just increase the value in Cell B3.

    The "Tally" worksheet contains four named (single cell) ranges and two Named Formulas which are used in the SUMIF formula mentioned above - if you delete Row 5 or the row containing the "Total Length" cell, neither the SUMIF formula nor the VBA code will work correctly. I don't know how you intend to use the worksheet, so I do not know what "Anti-Gorilla" protection is appropriate.

    I hope the attached is useful for you - please let me know how you get on.

    Greg M
    Attached Files Attached Files

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Help for Novice on Work Project

    Hi, and welcome to the forum. Unfortunately your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    12-13-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA Help for Novice on Work Project

    Greg,
    You nailed it. Works great!
    I appreciate your help.
    Thomas

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Help for Novice on Work Project

    Quote Originally Posted by CajunAg View Post
    Greg,
    You nailed it. Works great!
    I appreciate your help.
    Thomas
    We're pleased that you've received a solution but please note that any future posts should contain a meaningful title as per the forum rules. That point was obviously missed by Greg

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] hELP FOR MY PROJECT (IN PROJECT SHEET CODE NOT WORK,, OUTSIDE THAT CODE WORK)
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-06-2013, 06:53 AM
  2. [SOLVED] Novice trying to work how assign value in a cell based on another cell
    By jcartworx in forum Excel General
    Replies: 7
    Last Post: 08-30-2012, 01:30 PM
  3. Work-date project
    By greekboyuk in forum Excel General
    Replies: 0
    Last Post: 05-17-2012, 08:54 AM
  4. Cross-Referencing Help for Work Project
    By clayferg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2009, 04:48 PM
  5. Beginner needs help w/first work project
    By Buckwheat in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-12-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1