hiding a row on one sheet based on a value in another sheet.

DancingBay

New Member
Joined
Aug 7, 2020
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Invoice sheet: 08-AUG
Work Schedule: 08-WS

I pull relevant cells from my invoice sheet to my work schedule sheet. The invoice items starts at row 13. The work schedule items start at row 2.
When I complete a task, I put an "a" (webdings checkmark) in column G. Doing this calculates qty * price so I can get paid.
I start out with 100 rows of tasks per month, sometimes there are more, sometimes less.
so...
=IF('08-AUG'!$G13="a",hide the row with the value ='08-AUG'!A13 on '08-WS', which is row 2)
column S is the work description.
and do this for each row.
If it would be easier to start the work schedule sheet on row 13, I can do that.

I have never programmed any excel macros, but do know how to code in PHP. I'm hoping there's a better way to hide these completed rows other than manually.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I have you ws sheet set up like this


1596889092725.png



Invoice sheet set up like this

1596889152167.png



After you run the code this is the end result

1596889200666.png



Code

VBA Code:
Sub Get_a_cell()
    Dim sh As Worksheet, ws As Worksheet
    Dim rng As Range, c As Range, LstRw As Long

    Set sh = Sheets("08-WS")
    Set ws = Sheets("08-AUG")

    With sh
        Set rng = .Range("G2:G" & .Cells(.Rows.Count, "G").End(xlUp).Row)
        For Each c In rng.Cells
            If c = "a" Then
                With ws
                    LstRw = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
                    .Cells(LstRw, "A") = c.Offset(, -1)
                    .Cells(LstRw, "B") = c.Offset(, 12)
                End With
            End If
        Next c
    End With



End Sub
 
Upvote 0
That's almost correct. The checkmark is on the invoice page. I want to hide the rows on the worksheet based on the checkmark on the invoice. I am doing it this way so that when I complete a project, the billing is calculated. So... on the worksheet, I want to hide rows 2-16, 18, 19. I'm going to study this and see if I can figure it out, but if it's vastly different, please let me know.
Thanks,
Alisa
 

Attachments

  • invoice.PNG
    invoice.PNG
    97.9 KB · Views: 4
  • worksheet.PNG
    worksheet.PNG
    43.9 KB · Views: 4
Upvote 0
Do I need to start my sh sheet at row 13 so the rows numbers match on each sheet? Like this?
I'm assuming that variable names can be more than 2 characters. It helps to make the names as descriptive as I can without getting too cluttered.
Thanks,
Alisa.
 

Attachments

  • top-inv.PNG
    top-inv.PNG
    15.2 KB · Views: 6
  • top-ws.PNG
    top-ws.PNG
    7.3 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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