+ Reply to Thread
Results 1 to 10 of 10

Cannot insert cells into VBA?

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Cannot insert cells into VBA?

    Hi All,

    I'm trying to insert cell reading into my exclusively VBA based program. I've learned that it's easier to update an excel spreadsheet than
    update the VBA. Therefore, for the following code below, does anyone know how I could get the program to read:

    Worksheet: AXLE DATA, column C4 = BRCKT010, D4 WEIGHT (3.585)


    instead of:

    Please Login or Register  to view this content.
    Can anyone assist to get me started? Many Thanks

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Cannot insert cells into VBA?

    It's not clear to me what is your data structure in the worksheet, nor where this code is inserted, but let's try at the beginning:

    Please Login or Register  to view this content.
    or may be:

    Please Login or Register  to view this content.

    If that's not enough, will you please attach a SMALL sample Excel workbook(s) (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. (If trere are typical cases like: all unique values/duplicates could occur, day/night, nobody present/several persons at once, before/on/past due, etc. - please show them all or at least indicate in text) The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution(s) is/are also shown (mock up the results manually).

    3. Make sure that all confidential/restricted information (either personal or business) like real e-mails, social security numbers, bank accounts, etc. is removed first!!

    To attach an Excel file you have to do the following: Just before posting, scroll down and press Go Advanced button and then scroll down and press Manage Attachments link. Now follow the instructions at the top of that pop-up screen.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Cannot insert cells into VBA?

    Thanks mate, yes I'm sorry about that. I'll try your advice now and get back to you .

  4. #4
    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: Cannot insert cells into VBA?

    As Kaper said it would be useful to see your workbook. Howvere if ComboBox20 does contain items like "BRCKT010" then perhaps:


    Please Login or Register  to view this content.
    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.

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Cannot insert cells into VBA?

    Sorry, yes I understand I've not provided enough information as the VBA is very busy. What I'm basically trying to do is to Store updatable/additional/changeable data in a spreadsheet
    as I've stored everything in VBA and made its file size stupid and I figure it would be easier to update a worksheet than entering into the land of VBA.

    Therefore, it may be best if i start simply at the array data. Could you direct me how I could have the VBA select from the DATA worksheet as opposed to the VBA as demonstrated below:

    Please Login or Register  to view this content.

    This way I could delete the choices from VBA and store them in a spreadsheet. As you can tell I've limited experience. Thank you for any assistance :-)

  6. #6
    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: Cannot insert cells into VBA?

    If I understand the question and you've a list of values in the worksheet that you want to appear in the ComboBox then the simplest way of populating one of the Controls, like a ComobBox, ListBox etc. with values is to use the .RowSource property

    List the values you want to populate in a range of cells and give a name to the range say 'MyRange'

    Then in the Properties window of the combobox enter the name MyRange

  7. #7
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Cannot insert cells into VBA?

    Lol, that's way beyond me lol

    Could it be something like this?:



    Please Login or Register  to view this content.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,292

    Re: Cannot insert cells into VBA?

    You'd want more than one cell:

    Please Login or Register  to view this content.
    for example, where Z2:Z20 contain your list values.

    Regarding your initial question, I suspect you'd be better off just using a lookup table and finding the selected value and its corresponding data, instead of using a Select Case construction.
    Remember what the dormouse said
    Feed your head

  9. #9
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Cannot insert cells into VBA?

    Great, I'll give that a whirl now :-)

  10. #10
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Cannot insert cells into VBA?

    That worked great. I can now store my data in a Worksheet and free up the VBA. Thank you very much.

    I will mark this tread as "Solved" as I've enough work for a month moving this over Lol

+ 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] Insert limited cells when you insert a row
    By Willows59 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-05-2019, 11:14 PM
  2. Vba that moves cells with text, (up and to left, insert row/ insert copied cell)
    By sergi117 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2018, 03:12 PM
  3. Replies: 0
    Last Post: 05-26-2016, 05:54 AM
  4. Replies: 3
    Last Post: 07-26-2014, 06:12 AM
  5. Replies: 1
    Last Post: 03-29-2014, 09:56 AM
  6. Replies: 3
    Last Post: 10-25-2012, 07:10 AM

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