PDA

View Full Version : VB help, please...



Lorn
2008-01-19, 12:59 PM
Without getting bogged down by details, how would I get a VB macro (in MS Excel) to copy a set of cells, then paste them into the first available row in another worksheet?

The copy/paste part I'm mostly fine with, it's mostly finding the free cell (preferably without about 200 IF statements) that's a problem.

I COULD get it working otherwise (just inserting the data at row, say, 1457) but then it'd be less effective, seeing as I want it to be able to keep data with the only limit the actual maximum size of the sheet.

If you can answer, THANK YOU.

SMEE
2008-01-19, 04:25 PM
Sub FirstBlank(Sheet as string)
Sheets(Sheet).Activate
If ActiveSheet.Range("A1").Value = "" Then
ActiveSheet.Range("A1").Select
Else
ActiveSheet.Range("A1").End(xlDown).Select
End If
End Sub

This would do.
You pass the sheet name as the parameter and it activates the first blank cell in the A column.

Lorn
2008-01-20, 05:31 AM
Thanks :) It's basically working, I just need to change a bit pf the previous macro first.