+ Reply to Thread
Results 1 to 12 of 12

Trying to activate cells by input in other cells

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

    Trying to activate cells by input in other cells

    Hi,

    I'm sure there's some capable individuals on here who can offer assistance on this basic VBA conundrum.
    If I place 750 in say, cell B4 I'd like cell B7 to reveal 54. I'd like to achieve this using VBA if possible.

    many thanks
    Last edited by bralew; 07-07-2016 at 07:12 AM.

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: VBA problem

    a) Could you please change your post title to better reflect your issue; maybe something like "Reveal cell value based on input in another cell" so that future searchers with similar issues can find this thread?

    b) Is VBA a requirement? This sounds like something that can be fixed with an IF formula...

    c) Is there some math that gets you from 750 to 54, or is it just a straight - If 750, then 54 - link?

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

    Re: VBA problem

    Hi thanks for your response.

    The numbers are unrelated mathematically and I've managed the spreadsheet using the IF command in Excel. However, the complexity of the file has grown and I need a solution in VBA format.
    There are multiple commands but I can adapt this one to suit the rest.

    Thanks, the 750 to 54 is just a link as you've illustrated in your previous post

    (No sure where I can edit the title of my post)
    Last edited by bralew; 07-05-2016 at 10:48 AM.

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: VBA problem

    To change the title of the thread, click EDIT on the original post, then click the Go Advanced button, then change the title. If two or more days have passed, the EDIT button will not appear, and you need to ask a moderator to change the title.

    Is there a range, or particular pattern to what gets changed, what cell it effects, and why? A worksheet change event can be written for every relevant cell, but that approach will be far less efficient than IF formulas or a selection change even covering a wide range of cells. For the operation you've specified, it would look like this:

    Please Login or Register  to view this content.
    You could add additional cell combos by expanding the intersect range and using ElseIf conditions, but =IF(B4=750,54,"") in B7 and the other necessary cells would be easier to maintain.

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

    Re: VBA problem

    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Range("C5").Value = 750 Then
    Range("C4").Value = 54
    Else
    Range("B8").ClearContents
    End If
    Application.EnableEvents = True
    End Sub


    Hi all,

    Thanks for your input. Both examples worked brilliantly. However, I have chosen the above code because its easier for me to understand given my infancy
    using VBA code.
    I also require an additional instruction but I'd like it put into another Private Sub (is this a procedure?) as I can create notes and generally navigate easier.
    The instruction alongside the above is to change C6 to'P' and C3 to 'Square' and C8 to unbraked.
    The data validation that exists over rides the macro which is perfect as these are default instructions which can change considerably at times
    but are great for starting.
    I should be able to struggle on after this.

    cheers all

  6. #6
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: VBA problem

    I'm glad you found something that worked! You can safely refer to what you have as a "procedure". For your next step, I'm not sure what you mean by "alongside the above"? If you want it to only happen when C5 = 750, then you can add:
    Please Login or Register  to view this content.
    directly beneath your Range("C4").Value = 54 line (and above the "Else"). If you want it to happen every time there's a worksheet change, then add the same three lines beneath your "End If" line.

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

    Re: VBA problem

    Thank you Cantosh, ill give it a try now

    :-)

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

    Re: VBA problem

    Cantosh, your a bloody genius!!!

    Thanks ever so much.

    I have one more conundrum and I should be able to struggle on.

    I need a separate instruction to do the same as the first but this time another product. I need to select 1800 in cell C5 and this then to turn C6 to "Y", C4 to "77" and C9 to 250x40

    Can you help?

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

    Re: VBA problem

    Hi cantosh, can you tell me why the macro you sent works in the form sheet in VBa editor but not in the Module, I used to fire them from module. will it make a difference that ive put them in the sheet?

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,935

    Re: VBA problem

    @bralew
    While we don't have many rules in this forum, you have apparantly violated two of them. Please take the time to read the rules you agreed to when you joined this forum and correct the issues below.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    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



    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 go to your first 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)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    Re: Need Advice

    Thanks Cantosh,

    I've changed the title of my thread and will use the necessary code marks in furure,

    thanks

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,935

    Re: Trying to activate cells by input in other cells

    @bralew

    Please read the forum rules. Your change to your thread title is still not in compliance with the rules and please edit your current posting to correct the code tags.

+ 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] Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem
    By LennartB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2015, 06:58 AM
  2. Replies: 6
    Last Post: 10-20-2013, 07:16 PM
  3. input box problem, cell filtering problem, result display while locking sheet
    By croozin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 08:52 AM
  4. Replies: 6
    Last Post: 05-28-2013, 05:08 PM
  5. Replies: 2
    Last Post: 01-22-2013, 07:09 AM
  6. Problem using formulas within macro + problem with defined name.
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2011, 04:39 AM
  7. [SOLVED] Started out as an Access problem. Now an Excel problem
    By RobertM in forum Excel General
    Replies: 2
    Last Post: 04-26-2006, 02:35 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