Generating worksheet that omits rows with zero values

Jim Page

New Member
Joined
Aug 3, 2007
Messages
20
I am trying to create a new worksheet from data in another. However, this new worksheet contains a lot of blank rows where non pertinent data exists.

The formula is simple i.e. =if(sheet1!A3=1, Sheet1!C3,"")

Column A in Sheet1 contains a series of 0 & 1's dictating wherever data in that row relates to a particular subset of information.

However, in teh new sheet I have created, where it sees a 0 in Column A it leaves me with a blank row. I could obviously hide or delete these rows, but this will cause me problems when I amend Sheet 1. I want to automate this process and probably need to use a Macro, but do not have the know-how.

Can anyone help?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi
Paste the following codes in the macro window ( Alt F11)
Code:
Sub sss()
Dim a, b, x As Integer
b = 1
x = Cells(Rows.Count, 1).End(xlUp).Row
For a = 1 To x
If Cells(a, 1) <> "0" Then
Worksheets("sheet2").Cells(b, 1) = Cells(a, 3)
b = b + 1
End If
Next a
End Sub
run the macro. It will list all values of col C where values of col A in correspong row is not zero.
Ravi
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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