Macro Issue

henners7

New Member
Joined
Nov 14, 2012
Messages
8
Please could anyone help me with this, it's for my dissertation and aims to delete all the data in a spreadsheet that isn't required (as it is a standardized set of data which is unneeded).

I'm getting the error 'Compile error: Argument not optional' but have no idea why.

Any help would be so greatly appreciated.

Sub Delete_Rows()
'
' Delete_Rows Macro
'

'
Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33" _
).Select
Range("A33").Activate
ActiveWindow.SmallScroll Down:=18
Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43" _
).Select
Range("A43").Activate
ActiveWindow.SmallScroll Down:=21
Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70" _
).Select
Range("A70").Activate
Columns("A:A").ColumnWidth = 15.5
ActiveWindow.SmallScroll Down:=11
Union(Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A82").Activate
ActiveWindow.SmallScroll Down:=29
Union(Range( _
"87:87,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80" _
), Rows("82:82")).Select
Range("A87").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54" _
), Range("59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82")).Select
Range("A110").Activate
ActiveWindow.SmallScroll Down:=20
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32" _
), Range( _
"33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A122").Activate
ActiveWindow.SmallScroll Down:=17
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,2:2,3:3,4:4,5:5,7:7,13:13,19:19" _
), Range( _
"20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A143").Activate
ActiveWindow.SmallScroll Down:=24
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71" _
), Range("74:74,72:72,76:76,80:80,82:82")).Select
Range("A172").Activate
ActiveWindow.SmallScroll Down:=29
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53" _
), Range("54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82")).Select
Range("A198").Activate
ActiveWindow.SmallScroll Down:=20
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31" _
), Range( _
"32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A210").Activate
ActiveWindow.SmallScroll Down:=12
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30" _
), Range( _
"31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A215").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27" _
), Range( _
"30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A221").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20" _
), Range( _
"21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A226").Activate
ActiveWindow.SmallScroll Down:=11
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A242").Activate
ActiveWindow.SmallScroll Down:=29
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32" _
), Range( _
"33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A270").Activate
ActiveWindow.SmallScroll Down:=10
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21" _
), Range( _
"22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A276").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20" _
), Range( _
"21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A277").Activate
ActiveWindow.SmallScroll Down:=15
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,2:2,3:3" _
), Range( _
"4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A296").Activate
ActiveWindow.SmallScroll Down:=31
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54" _
), Range("59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82")).Select
Range("A329").Activate
ActiveWindow.SmallScroll Down:=27
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27" _
), Range( _
"30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A349").Activate
ActiveWindow.SmallScroll Down:=20
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A370").Activate
ActiveWindow.SmallScroll Down:=23
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"375:375,376:376,377:377,378:378,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74" _
), Range("72:72,76:76,80:80,82:82")).Select
Range("A378").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"375:375,376:376,377:377,378:378,379:379,383:383,385:385,386:386,387:387,388:388,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53" _
), Range("54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82")).Select
Range("A388").Activate
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"375:375,376:376,377:377,378:378,379:379,383:383,385:385,386:386,387:387,388:388,391:391,395:395,399:399,400:400,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44" _
), Range( _
"45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A400").Activate
ActiveWindow.SmallScroll Down:=29
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"375:375,376:376,377:377,378:378,379:379,383:383,385:385,386:386,387:387,388:388,391:391,395:395,399:399,400:400,401:401,402:402,405:405,411:411,416:416,420:420,2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30" _
), Range( _
"31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A420").Activate
ActiveWindow.SmallScroll Down:=24
Union(Range( _
"87:87,96:96,97:97,99:99,103:103,105:105,107:107,109:109,110:110,112:112,113:113,114:114,115:115,116:116,117:117,120:120,121:121,122:122,123:123,128:128,134:134,140:140,141:141,142:142,143:143,147:147,152:152,154:154,158:158,162:162,166:166,167:167" _
), Range( _
"168:168,169:169,170:170,171:171,172:172,174:174,181:181,183:183,187:187,198:198,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,215:215,221:221,224:224,225:225,226:226,233:233,236:236,237:237,238:238,239:239,240:240,241:241,242:242" _
), Range( _
"244:244,245:245,246:246,247:247,249:249,250:250,251:251,252:252,254:254,255:255,256:256,257:257,258:258,259:259,261:261,265:265,269:269,270:270,272:272,273:273,274:274,275:275,276:276,277:277,281:281,285:285,293:293,294:294,295:295,296:296,300:300,303:303" _
), Range( _
"308:308,309:309,310:310,311:311,314:314,317:317,322:322,326:326,329:329,333:333,334:334,335:335,336:336,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,352:352,355:355,358:358,361:361,362:362,363:363,364:364,367:367,368:368,369:369,370:370" _
), Range( _
"375:375,376:376,377:377,378:378,379:379,383:383,385:385,386:386,387:387,388:388,391:391,395:395,399:399,400:400,401:401,402:402,405:405,411:411,416:416,420:420,424:424,428:428,431:431,436:436,444:444,441:441,450:450,2:2,3:3,4:4,5:5,7:7" _
), Range( _
"13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A450").Activate
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=-175
Rows("264:379").Select
Selection.Delete Shift:=xlUp
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
You are not really expecting someone to spend time picking through that?

Try posting a sample of your data, and what you would like to do with it
 
Upvote 0
I'm not sure why it's so long, i guess to keep scrolling down the page. How about this bit;

Range("A70").Activate
Columns("A:A").ColumnWidth = 15.5
ActiveWindow.SmallScroll Down:=11
Union(Range( _
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:53,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82" _
)).Select
Range("A82").Activate
ActiveWindow.SmallScroll Down:=29
Union(Range( _
 
Upvote 0
from my investigation its your first UNION statement that is causing the problem, I think, because it appears to have only 1 argument and hence has nothing with which to form a union!

Not really sure what the code is doing, but cant help feeling there is a much better way of writing it.
 
Upvote 0
All i'm trying to do is delete multiple rows. I thought it might be quite simple.

aka

Range (
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:5 3,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82"
Select
Delete

type thing!
 
Upvote 0
All i'm trying to do is delete multiple rows. I thought it might be quite simple.

aka

Range (
"2:2,3:3,4:4,5:5,7:7,13:13,19:19,20:20,21:21,22:22,27:27,30:30,31:31,32:32,33:33,42:42,43:43,44:44,45:45,51:51,52:52,53:5 3,54:54,59:59,67:67,70:70,71:71,74:74,72:72,76:76,80:80,82:82"
Select
Delete

type thing!

Basically, it is (almost) that simple, although if you could describe what criteria you are using to select the indicated rows of data, perhaps we could write a nice short macro for you that would save you an enormous amount of manual time. Anyway, to answer the question you are asking...

Code:
Range("2:5,7:7,13:13,19:22,27:27,30:33,42:45,51:54,59:59,67:67,70:72,74:74,76:76,80:80,82:82").Delete
I want you to notice how I have shortened your ranges by conbining adjacent rows into a single range. The red highlighted text parts should give you an idea of the technique. Although I am not sure of XL2010, this is important because there is a 255 (or so) character limit on the length of the text string that can be specified as the argument to a Range call.
 
Upvote 0
I'm downloading data from Eurostat. This data is in a standardized form and contains 261 useful rows, but, unfortunately and extra 200 useless ones (ie many 'Extra-regio 1' rows, or rows pertaining to regions or countries out of my field of study). Thus I'd like to delete all the rows that are useless, the rows are the same on every downloaded Eurostat data files. Thanks for that Rick, I will try it.
 
Upvote 0
How do you identify the 'useless' rows?
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top