Thread: error 1004
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Macin Macin is offline
external usenet poster
 
Posts: 2
Default error 1004

Welcome Everyone,

I have a problem with the following code.

I want to select multiple rows in a very huge spreadsheet. But, when I
use this code, I receive an error: Runtime error 1004, Method 'Range'
of Object '_global' failed. What is wrong? Or maybe there is other
better way to select autmatically empty rows in a spreadsheet?

Thanks for help,
Martin

Public Sub delhol()
'
' delhol Macro
'
' Keyboard Shortcut: Ctrl+d
'

Dim k As Variant
Dim rr As String

k = Array(34, 35, 38, 39, 40, 77, 133, 182, 207, 209, 225, 226, 295,
299, 300, 338, 394, 437, 468, 470, 480, 481, 560, _
591, 599, 655, 712, 729, 746, 755, 756, 852, 860, 962, 990, 1005,
1006, 1077, 1081, 1082, 1083, 1114, 1176, _
1217, 1252, 1260, 1261, 1338, 1342, 1343, 1344, 1375, 1381, 1437,
1492, 1511, 1513, 1535, 1536, 1599, 1603, 1604, 1605, _
1642, 1698, 1742, 1772, 1774, 1785, 1786, 1860, 1864, 1865, 1903,
1959, 1997, 2033, 2034, 2035, 2040, 2041, _
2121, 2122, 2126, 2156, 2157, 2165, 2271, 2272, 2315, 2316, 2381,
2386, 2387, 2418, 2526, 2527, 2556, 2570, 2571, _
2576)

rr = "A" & k(0) & ":EO" & k(0)
For i = 1 To 25 'UBound(k) - 1
rr = rr & ", A" & k(i) & ":EO" & k(i)
Next

Range(rr).Select