Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]() HI, I would like to know to selected multiple ranges and clear the contents presently my code is like this: Range("C2:L2").Select Selection.ClearContents Range("N2").Select Selection.ClearContents ActiveWindow.SmallScroll ToRight:=6 Range("O2:R2").Select Selection.ClearContents Range("T2:W2").Select Selection.ClearContents I wanted to writed in one line like: Range("C2:L2","N2","O2:R2","T2:W2").Select Selection.ClearContents Any possibility. thanks in advance regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 |
#2
![]() |
|||
|
|||
![]()
How about:
Range("C2:L2,N2,O2:R2,T2:W2").ClearContents No need to select first. nowfal wrote: HI, I would like to know to selected multiple ranges and clear the contents presently my code is like this: Range("C2:L2").Select Selection.ClearContents Range("N2").Select Selection.ClearContents ActiveWindow.SmallScroll ToRight:=6 Range("O2:R2").Select Selection.ClearContents Range("T2:W2").Select Selection.ClearContents I wanted to writed in one line like: Range("C2:L2","N2","O2:R2","T2:W2").Select Selection.ClearContents Any possibility. thanks in advance regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 -- Dave Peterson |
#3
![]() |
|||
|
|||
![]()
hi
As you wished. Range("C2,C2:L2,N2,O2:R2,T2:W2").Select But you do know that N2,O2:R2 is the same as N2:R2. Regards FSt1 "nowfal" wrote: HI, I would like to know to selected multiple ranges and clear the contents presently my code is like this: Range("C2:L2").Select Selection.ClearContents Range("N2").Select Selection.ClearContents ActiveWindow.SmallScroll ToRight:=6 Range("O2:R2").Select Selection.ClearContents Range("T2:W2").Select Selection.ClearContents I wanted to writed in one line like: Range("C2:L2","N2","O2:R2","T2:W2").Select Selection.ClearContents Any possibility. thanks in advance regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 |
#4
![]() |
|||
|
|||
![]() Hi Mr.Dave Peterson, Done, thank u very much. It saves lot of time while running the macro. with regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 |
#5
![]() |
|||
|
|||
![]()
Did you see FSt1's note:
But you do know that N2,O2:R2 is the same as N2:R2. Sometimes, cleaning this kind of thing up when you notice it means you won't be wondering why you did it that way before. nowfal wrote: Hi Mr.Dave Peterson, Done, thank u very much. It saves lot of time while running the macro. with regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 -- Dave Peterson |
#6
![]() |
|||
|
|||
![]() Hi Mr.Dave Peterson, I saw his(FSt1) question, but it is not inside that. N2 is separately cleaning , i wanna to avoid 5 cells from clean ie. M2,S2,X2,AC2,AH2 b coz it contains formula that too the macro unprotecting the sheet on the begining. (Range("C2:H2,J2:L2,N2,O2:R2,T2:W2,Y2:AB2,AD2:AG2" ).ClearContents) . As u said to be frank , 3 months before i was nothing (still i am a KG student comparing guys like u) now atleast i can say i have done some good work, which is using almost 50 people in different branches of my company. So better portion of the credit goes to guys like u Dave, Bob, etc etc . So keep it up helping others. Thanks a lot with regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 |
#7
![]() |
|||
|
|||
![]()
Fstl's point was that the cell N2 is inside the range O2:R2, so:
This formula Range("C2:H2,J2:L2,N2,O2:R2,T2:W2,Y2:AB2,AD2:AG2") .ClearContents is equivalent to: Range("C2:H2,J2:L2,O2:R2,T2:W2,Y2:AB2,AD2:AG2").Cl earContents You wouldn't have to specify N2, since it's in the middle of O2:R2. nowfal wrote: Hi Mr.Dave Peterson, I saw his(FSt1) question, but it is not inside that. N2 is separately cleaning , i wanna to avoid 5 cells from clean ie. M2,S2,X2,AC2,AH2 b coz it contains formula that too the macro unprotecting the sheet on the begining. (Range("C2:H2,J2:L2,N2,O2:R2,T2:W2,Y2:AB2,AD2:AG2" ).ClearContents) As u said to be frank , 3 months before i was nothing (still i am a KG student comparing guys like u) now atleast i can say i have done some good work, which is using almost 50 people in different branches of my company. So better portion of the credit goes to guys like u Dave, Bob, etc etc . So keep it up helping others. Thanks a lot with regards nowfal -- nowfal ------------------------------------------------------------------------ nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003 View this thread: http://www.excelforum.com/showthread...hreadid=392092 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dynamic named range across multiple sheets | Excel Discussion (Misc queries) | |||
sum multiple criteria where final range is text? | Excel Discussion (Misc queries) | |||
Product Function in Pivot Tables from Multiple Consolidation Range | Excel Worksheet Functions | |||
SUMIF multiple criteria in 1 range | Excel Worksheet Functions | |||
Sum a range across multiple sheets | Excel Worksheet Functions |