Forum Discussion
SamFares
Nov 14, 2019Brass Contributor
Macro to delete certain cells in several columns depending cell value in a different cell
Hello All, In the attached Excel sheet, "Input Continuous-Span Beam" tab, I'd like a macro to do the following when: 1. Cell B10=2, to delete the cells highlighted in yellow for Span#3,4&5 only. ...
- Nov 15, 2019
This code will CLEAR the ranges depending on 2, 3 or 4. Deleting them would screw your entire sheet, I guess.
Sub ClearSpan() Dim NoSpansN As Integer NoSpansN = Range("B10").Value Select Case NoSpansN Case 2 Range("J17:U58").Select Selection.Clear Case 3 Range("N17:U58").Select Selection.Clear Case 4 Range("R17:U58").Select Selection.Clear End Select Range("B10").Select End SubThe next code will clear the contents of the yellow cells in the LE and RE Cantilever sections:
Sub DeleteLE_RE() Range("D60:D65,G64,H60,Q60:Q65,T64,U60").Select Selection.ClearContents End SubIf this is not what you have in mind, please clarify your needs.
Riny_van_Eekelen
Nov 15, 2019Platinum Contributor
This code will CLEAR the ranges depending on 2, 3 or 4. Deleting them would screw your entire sheet, I guess.
Sub ClearSpan()
Dim NoSpansN As Integer
NoSpansN = Range("B10").Value
Select Case NoSpansN
Case 2
Range("J17:U58").Select
Selection.Clear
Case 3
Range("N17:U58").Select
Selection.Clear
Case 4
Range("R17:U58").Select
Selection.Clear
End Select
Range("B10").Select
End SubThe next code will clear the contents of the yellow cells in the LE and RE Cantilever sections:
Sub DeleteLE_RE()
Range("D60:D65,G64,H60,Q60:Q65,T64,U60").Select
Selection.ClearContents
End SubIf this is not what you have in mind, please clarify your needs.
- SamFaresNov 20, 2019Brass ContributorI appreciate it and Thank you so much!
Sam