Wednesday, September 7, 2016

How to Resolve - Can this Code be Modified to work?

Can this Code be Modified to work

I am using below Code & it Works can this be modified to also clear contents H2 O2 & V2 in the same manner
 
Private Sub Worksheet_Change(ByVal Target As Range)
     If Target.Count > 1 Then Exit Sub
     If Not Intersect(Target, Range("D2,L2,T2")) Is Nothing Then
         If Target.Address = Range("T2").Address Then
         Target.Range("A4:A43").ClearContents
           Else
         Target.Range("A4:A43").ClearContents
         End If
     End If
 If Not Intersect(Target, Range("D2")) Is Nothing Then
    Application.EnableEvents = False
    Range("D88:J100").ClearContents
    Application.EnableEvents = True
    Exit Sub
End If
If Not Intersect(Target, Range("L2")) Is Nothing Then
    Application.EnableEvents = False
    Range("K88:Q100").ClearContents
    Application.EnableEvents = True
    Exit Sub
End If
If Not Intersect(Target, Range("T2")) Is Nothing Then
    Application.EnableEvents = False
    Range("R88:Y100").ClearContents
    Application.EnableEvents = True
    Exit Sub
End If
End Sub

Anwsers to the Problem Can this Code be Modified to work

Download SmartPCFixer to Fix It (Free)

I tried your Code & got Error with :
...

Sometimes pasting the code from the web will result in non-breaking spaces and/or extra line feeds.
Change those three lines to,

Target.Offset(86, (Target.Column > 8) + (Target.Column > 15)).Resize(13, 7 -  (Target.Column > 15)).ClearContents

That should all be on one line with spaces and no non-breaking spaces.


···
         If Target.Address = Range("R2").Address Then
         Target.Range("A4:A43").ClearContents
           Else
         Target.Range("A4:A43").ClearContents
         End If
···

I still do not understand the purpose of this.
A4:A43 will be cleared regardless of whether or not the
Target address matches R2's address.
Why not just clear it and forego the address check altogether?

Here is a modification to address the new ranges you've posted,

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("D2,K2,R2")) Is Nothing Then
        On Error GoTo FallThrough
        Application.EnableEvents = False
        Target.Offset(0, 4).MergeArea.ClearContents
        Target.Offset(3, 0).Resize(40, 1).ClearContents
        Target.Offset(86, 0).Resize(13, 7 - (Target.Column = 18)).ClearContents
    End If
FallThrough:
    Application.EnableEvents = True
End Sub


It will accomplish the following:


D2 clears D88:J100 & D5:D44 & $H$2:$J$2
K2 clears K88:Q100 & K5:K44 & $O$2:$Q$2
R2 clears R88:Y100 & R5:R44 & $V$2:$X$2


I sincerely hope I got that correct this time around.
If not, please provide specific range addresses to clear for each cell triggering hte
Worksheet_Change event macro.

To check for Windows updates

  1. Open Windows Update by clicking the Start button Picture of the Start button, clicking All Programs, and then clicking Windows Update.
  2. In the left pane, click Check for updates, and then wait while Windows looks for the latest updates for your computer.
  3. If any updates are found, click Install updates. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

Another Safe way to Repair the Problem: Can this Code be Modified to work:

How to Fix Can this Code be Modified to work with SmartPCFixer?

1. Click the button to download Error Fixer . Install it on your system.  Open it, and it will scan your computer. The errors will be shown in the list.

2. After the scan is done, you can see the errors and problems need to be repaired. Click Fix All.

3. The Repair part is finished, the speed of your computer will be much higher than before and the errors have been removed. You can also use other functions in SmartPCFixer. Like dll downloading, junk file cleaning and print spooler error repair.


Related: How to Download Toshiba Satellite A205-S5833 Supervisor Password Utility v.1.48.0.8C r2 driver,How to Download Toshiba Satellite C675-S7104 Laptop Checkup v.2.0.13.11 driver,How Can I Update & Download Toshiba Satellite L655-S5117 Face Recognition v.3.1.3 driver,Method to Update & Download Toshiba Satellite L845D-SP4328KL Atheros LAN Driver v.2.1.0.5,How to Update & Download Toshiba Satellite R930 Network Device ID Registry Setting Tool v.3.0.32.4 driver,Best Way to Download NVidia GeForce 6100 VGA Driver v.304.51 Certified,How Can You Update & Download NVidia GeForce 9300/nForce 730i VGA Driver v.310.19 Certified,Method to Download NVidia GeForce GT 330M Driver v.340.65,How Can I Update & Download NVidia GeForce GTX 590 Driver v.280.26 WHQL,Method to Download NVidia Tesla C2050 Driver v.319.17,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.8.17.12.6686,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.11.6.0.1030,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.9.3.0.1019,Method to Update & Download ASUS K41VD Intel INF Update Driver v.9.1.1.1015,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: [Solved] Can't access certain programs when looged in under different user accounts,How to Fix - Can I use text x-axis labels with a scatter chart instead of the defaults??,can i sort using Works Tech Support,[Solution] Can't find webcam on Windows 7 Ultimate,[Solution] Can you convert a voice file to a text file,Can I safely remove earlier versions on my pc,Can I rotate a graph so it shows on my page sideways?,Can I safely ignore Office file validation alert message?,Can I send a JPEG file in a PDF form ?,can I review when my computer has been accessed from outside my home?

No comments:

Post a Comment