Varying Named Range


Posted by Richard S on October 24, 2001 6:59 PM

Hi all,
Each month I import a text file containing 6 columns of data, but the number of rows may vary. I need to name all the data one name, and from A2 to the bottom of column A another name. I've tried a couple of variations on the xlup VBA command that I've seen on this board, but can't seem to get it quite right.
Any help appreciated
Richard

Posted by mseyf on October 25, 2001 7:18 AM


Richard:

this may be rather simplistic, but since you didn't get any other replys, you could try:

ActiveSheet.UsedRange.Name = "Range01"
Range("a2", "a" & Range("Range01").Rows.Count).Name = "Range02"

HTH

Mark



Posted by Richard S on October 25, 2001 2:45 PM

Run-time error 1004


Thanks for the response. The first one worked a treat, but the second one came up with Run-time error 1004, Method 'Range' of object '_Global' failed. Have I got spaces in the worng place or something? Sorry, not too good with VBA syntax etc.
Thanks
Richard