How to select cells in one Column based on another Column in Excel

darian

New Member
Joined
Jun 6, 2014
Messages
10
I have a pivottable and would like to select any cell in table range in column D that is equal to Cells in column A that are blank or not blank. here is what I wrote and ofcourse not working.
can you help me, please?

Code:
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"> [COLOR=#00008B]Function[/COLOR] Fromatting() 
   [COLOR=#00008B]Dim[/COLOR] ws [COLOR=#00008B]As[/COLOR] Worksheet 
   [COLOR=#00008B]Set[/COLOR] ws = ThisWorkbook.Sheets([COLOR=#800000]"Detailed Report"[/COLOR]) 
   [COLOR=#808080]'Set entire column "D" to %[/COLOR] 
   ws.Columns([COLOR=#800000]"D"[/COLOR]).Style = [COLOR=#800000]"Percent"[/COLOR] 
       [COLOR=#808080]'Set Cells in Column D to textFormat Where they are equal to empty Cells or non empty cells in Column A[/COLOR] 
        'Select range dynamically 
        [COLOR=#00008B]If[/COLOR] IsEmpty(ws.range([COLOR=#800000]"A5"[/COLOR], ws.range([COLOR=#800000]"A5"[/COLOR]).[COLOR=#00008B]End[/COLOR](xlDown)).Value) [COLOR=#00008B]Then[/COLOR] 
       ws.range([COLOR=#800000]"D5"[/COLOR], ws.range([COLOR=#800000]"D5"[/COLOR]).[COLOR=#00008B]End[/COLOR](xlDown)).[COLOR=#00008B]Select[/COLOR].NumberFormat = [COLOR=#800000]"@"[/COLOR] 
       [COLOR=#00008B]End[/COLOR] [COLOR=#00008B]If[/COLOR]    
[COLOR=#00008B]End[/COLOR] [COLOR=#00008B]Function[/COLOR]</code>
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You say... Set Cells in Column D to textFormat Where they are equal to empty Cells or non empty cells in Column A

The IsEmpty() function being used is only going the select the empty cells,, right?
 
Upvote 0
At this point, it doesn't matter. Im looking for a class method something to be able select column D based on either empty on non empty rows on column A. Since this is pivot table rows also change and I have difficulty to set dynamic range also.
I will appreciate anyhelp.
You say... Set Cells in Column D to textFormat Where they are equal to empty Cells or non empty cells in Column A

The IsEmpty() function being used is only going the select the empty cells,, right?
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,377
Members
448,955
Latest member
BatCoder

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