VBA Code to Copy Row (without hiddin coloums) based on an Empty Cell in Column V from one worksheet to Another Sheet

tcopeland

New Member
Joined
Feb 14, 2012
Messages
7
I inherited an excel file that has thousands of rows in one sheet and I have been asked to create a new sheet that only has specific coloumns (other coloumns have been hidden) and rows when there is a blank in Coloumn V. The names of the worksheets are Finalized Ks and Pending Ks. Any help would be appreciated. Thank you.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
This is untested so may need some tweaking. Assumes the source and destination sheets already exist and the pertinent columns to exclude on the source sheet are already hidden.
Code:
Sub tcopeland()
'run this code when sheet 'Finalized Ks' is the activesheet
Application.ScreenUpdating = False
On Error Resume Next
Sheets("Finalized Ks").UsedRange.SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Pending Ks").Range("A1")
On Error GoTo 0
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Re: VBA Code to Copy Row (without hidden coloums) based on an Empty Cell in Column V from one worksheet to Another Sheet

Joe,

Thank you. That worked to copy all the rows, not just the blank ones, but it did only copy the visible coloumns. Is there a way to limit to just the rows with contain no information in coloumn v?

Thank you again,

Tana
 
Upvote 0
Re: VBA Code to Copy Row (without hidden coloums) based on an Empty Cell in Column V from one worksheet to Another Sheet

Joe,

Thank you. That worked to copy all the rows, not just the blank ones, but it did only copy the visible coloumns. Is there a way to limit to just the rows with contain no information in coloumn v?

Thank you again,

Tana
You are welcome. Guess I didn't understand the col V impact - thought that was linked to which columns you hide. Assuming thos col V cells are truly blank (not having formulas that return an empty string), this should do what I think you want:
Code:
Sub tcopeland()
Application.ScreenUpdating = False
On Error Resume Next
Intersect(Sheets("Finalized Ks").UsedRange, _
    Columns("V")).SpecialCells(xlCellTypeBlanks).EntireRow.SpecialCells(xlCellTypeVisible).Copy _
    Destination:=Sheets("Pending Ks").Range("A1")
On Error GoTo 0
Application.ScreenUpdating = True
End Sub

Copy the code directly from your browser and overwrite the earlier code I posted with a paste.
 
Upvote 0
Re: VBA Code to Copy Row (without hidden coloums) based on an Empty Cell in Column V from one worksheet to Another Sheet

PERFECT!!!!

Thank you so much, that saved me hours of time.

:smile::smile::smile::smile:
 
Upvote 0
Re: VBA Code to Copy Row (without hidden coloums) based on an Empty Cell in Column V from one worksheet to Another Sheet

PERFECT!!!!

Thank you so much, that saved me hours of time.

:smile::smile::smile::smile:
You are welcome - thanks for the reply.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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