+ Reply to Thread
Results 1 to 3 of 3

Help with VBA/ Macros- Having trouble with the offsets into a second sheet

  1. #1
    Registered User
    Join Date
    06-30-2020
    Location
    hull, england
    MS-Off Ver
    Office 365
    Posts
    1

    Unhappy Help with VBA/ Macros- Having trouble with the offsets into a second sheet

    Hey everyone, I have 2 sheets and I'm trying to transfer info from the first sheet to the second. The first sheet is a contact form so that people can fill it in, this then populates the second sheet into a 'list' format. ie- the second persons info populates the next empty fields .
    At the minute the info is transferring to the second sheet but isnt moving to the next empty cells, it just writes over the previous info inputted. Can anyone see where i'm going wrong?

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by steveruston; 06-30-2020 at 01:54 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    40,480

    Re: Help with VBA/ Macros- Having trouble with the offsets into a second sheet

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new, I have done it for you today.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,846

    Re: Help with VBA/ Macros- Having trouble with the offsets into a second sheet

    Hi steveruston and welcome to ExcelForum,

    I updated your code to show you how I would solve the problem. In addition I replaced your 'ActiveX' submit CommandButton, with a 'Forms' CommandButton. 'ActiveX' controls do not play well with others (can cause corruption) and Forms Controls are easier to work with.

    You did a nice job for a first attempt. Try to modify the code to:
    a. Add a Header to Sheet2
    b. Do not allow update if an item is missing. Hint test using code like:
    Please Login or Register  to view this content.
    c. Test for items with invalid format (e.g. bad phone number)

    See the following code in Module1 of your modified Workbook (attached):
    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). http://www.cpearson.com/excel/DeclaringVariables.aspx

    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm

    If you need additional help with this, upload your file and add to this thread.

    Lewis
    Attached Files Attached Files

+ 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. Need help for coding in excel with VBA macros, multiple dynamic ranges and offsets
    By zouhair akkour in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2017, 11:41 AM
  2. Trouble with macros to save excel spreadsheet at PDF
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-04-2016, 11:03 AM
  3. [SOLVED] Trouble with Macros in Excel 2010
    By mosswood17 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-03-2013, 05:51 PM
  4. Trouble disabling macros
    By HelenStrand in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-21-2009, 11:35 AM
  5. VBA Problem - Pasting and Offsets - Layout Trouble.
    By m73a in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2007, 01:56 PM
  6. [SOLVED] Trouble calling Add-In Macros
    By scott.goldthwaite@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2005, 07:05 AM
  7. Trouble saving a worsheet to a file using macros.
    By phoenixx153 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2005, 06: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