• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

What is wrong with my code??

Hamish

Member
Code:
Sub CLEAR_ALL()

'
' CLEAR_ALL Macro
'
'
  Sheets("Sheet1").Select

 Range("F11,F12,J11,E15,E16,E18,H18,E20,G20,E21,G21,E22,G22,E23,G23,E24,G24,E26,E27,E28,F30,J30,G32,E32,E48,H48,H49,D51,D54,D56,D59,D61,D63,D64,D66,G66,D83,D86,D88,D91,D95,D96,D121,D124,D128,D131,D135,D136,D145,D156,D159,D163,D166,D170,D171,D190,D193,D195,D198,D202,D203,F236,C246,D246,F246,C248,C250,C251,E259,H259,J259,E260,H260,J260,E261,H261,J261,E262,E263").Select

 Selection.ClearContents
 Range("D1").Select
End Sub
 
Last edited by a moderator:
Hi Hamish ,

Your range selection statement is exceeding the limit of 256 characters for the range selection.

Split it up into 3 statements as follows :

Code:
s1 = "F11,F12,J11,E15,E16,E18,H18,E20,G20,E21,G21,E22,G22,E23,G23,E24,G24,E26,E27,E28,F30,J30,G32,E32,E48,H48,H49,D51,D54,D56,D59,D61,D63,D64,D66,G66,D83,D86,D88,D91,D95,D96,D121,D124,D128,D131,D135,D136,D145,D156,D159,D163,D166,D170,D171,D190,D193,D195,D198"
s2 = "D202,D203,F236,C246,D246,F246,C248,C250,C251,E259,H259,J259,E260,H260,J260,E261,H261,J261,E262,E263"

Union(Range(s1),Range(s2)).Select
Narayan
 
Back
Top