Issue with code - Need Help!

begoldar

Board Regular
Joined
Dec 20, 2005
Messages
98
Hi Everyone,

So, for some reason my code isn't working properly. I want it to skip over the blank cells when copying over the data from one worksheet to the other, but it's not doing it. Any suggestions? Thanks!

Dim x As Range, Allele As Range
Dim NextCell
Set x = Worksheets("Class II").Rows(1).Find(cmbLotII)
Set NextCell = Worksheets("Sheet1").Cells([3], [2])

If Not x Is Nothing Then Set Allele = x.Offset(1).Resize(99)
For Each d In Allele
If Not d = "" Then
NextCell.Value = (d.Value)
End If
NextCell.Select
Set NextCell = ActiveCell.Offset(0, 1)
Next d
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Please post code between tags when you click the # button.

You have several issues your code. Please state what you want to do.

e.g. Copy Sheet1!A1 to the last cell with data in column A to Sheet2!A1. Only copy cells with data. Data example: For Sheet1 with last data in A4 but no data in A2, copy A1, A3, and A4 to Sheet2!, A1, A2, A3.
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top