Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 05-18-2017, 08:18 PM
YW3 YW3 is offline Auto populate cell based on certain situations Windows 10 Auto populate cell based on certain situations Office 2016
Novice
Auto populate cell based on certain situations
 
Join Date: Jan 2017
Posts: 10
YW3 is on a distinguished road
Default

Oh! I'm so sorry, I forgot to mention that I'm not applying it to just one cell. A2:F2, in which A2 and B2 are merged, C2 is an un-merged cell, D2 and E2 are merged, and F2 is another un-merged cell. So it's actually 4 cells that needs to auto-populate '0'.

I've been editing the code to add in :F2. Is that the error?

I'm so sorry I missed this out.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
        If Range("A1").Value = "No" Then
            Range("A2:F2").Value = 0
            Range("A2:F2").Locked = True
        Else
            Range("A2:F2").Value = ""
            Range("A2:F2").Locked = False
        End If
    End If

End Sub
Edit: I tried it again with just one cell only (test both merged and un-merged), it still didn't work. I don't know what the problem is then.

Last edited by YW3; 05-18-2017 at 11:38 PM.
Reply With Quote
 

Tags
autopopulate



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto populate cell based on certain situations Excel to auto populate dates based on start and end patidallas22 Excel Programming 9 04-21-2014 03:14 PM
Auto populate cell based on certain situations trying to use vlookup to calculate several different situations in one cell heastlund Excel 3 11-21-2013 12:38 PM
Auto populate cell based on certain situations auto cell populate 2 Stevejd58 Excel 3 08-20-2013 04:23 PM
Auto populate cell based on certain situations auto cell populate Stevejd58 Excel 14 05-13-2013 02:22 AM
Auto-populate an MS Word table cell with text from a diff cell? dreamrthts Word Tables 0 03-20-2009 01:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft