PDA

Click to See Complete Forum and Search --> : selecting a row with a variable


LodBot
Jul 22nd, 2003, 11:36 AM
For a = 4 To last
If Sheets("Software Personnel").Range("K" & a).Value = "M760" Then
Sheets("Software Personnel").Select
Rows(a).Select
Selection.Cut
Sheets("M760 Personnel").Select
Rows(m760Last + count).Select
ActiveSheet.Paste
count = count + 1
End If
Next

When I try to run this code... I get an error "1004 Select Method of Range class failed" and doesn't like this line:

Rows(a).Select

Any ideas? Any different algorithms that would work?

Thanks,
Alex

lintz
Jul 22nd, 2003, 07:11 PM
This is how I highlight a row.....hope it helps


oXLApp.Worksheets("Sheet1").Select
ActiveCell.EntireRow.Select
Selection.Delete Shift:=xlUp

LodBot
Jul 24th, 2003, 10:54 AM
thanks

LodBot
Jul 29th, 2003, 12:51 PM
For a = 1 to 20
Sheets("New Personnel").Range("BB" & a).EntireRow.Select
Selection.Cut
Selection.Delete Shift:=xlUp
Next

I get:

1004 Select method of Range class failed

and it doesn't like this line:

Sheets("New Personnel").Range("BB" & a).EntireRow.Select

any ideas?

alex_read
Jul 31st, 2003, 05:46 AM
This works fine for me, have you declared a as an integer variable data type?

Matt_T_hat
Aug 5th, 2003, 07:09 AM
Is there a reason why Vlookup is not an option? Vlookup displays information from one cell by finding something in another. It's also be fast I would have thought.