Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank lines not "blank", creats many empty lines.

Status
Not open for further replies.

MarkBeck

Technical User
Mar 6, 2003
164
CA
Hi

The code below takes data from individual work cards (i.e., sheets("AD") below), and transfers it to a “central” sheet. Although the entire card is copied and pasted [Range("C16:p39")], not all lines are actually populated. The next paste looks for the first blank line in the “central” sheet [End(xlDown)], and pastes new data there.

However, even if only three lines were populated, the next paste will start at line 41! It seems that the lines in column "A" are not "really blank". This creates many blank lines in the central sheet.

Also note, that I included a [‘] at my MsgBox, since I keep getting a “compile error, expected value =”. I want to give the people the chance NOT to proceed with the transfer.

Here is my code;

Sub TransferData()
' msgbox("This action cannot be undone, and will transfer your data and blank your sheet.",vbOKCancel,"data transfer")

ActiveSheet.Unprotect
Sheets("Central").Visible = xlSheetVisible
Range("C16:p39").Select
Selection.Copy
Sheets("Central").Activate
ActiveSheet.Range("A1").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Central").Visible = xlSheetVeryHidden
Sheets("AD").Select
Range("F13").ClearContents
Range("D16:F39").ClearContents
Range("J16:p39").ClearContents
Range("E13").Select
ActiveSheet.Protect
MsgBox ("Please select week from drop-down list!")
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top