Complex macro for updating MDs at work

Roddy39

New Member
Joined
Feb 23, 2016
Messages
3
I have been trying to work on creating a macro to keep our patient information updated at work. We have 2 MDs and our patients change daily. The doctors have no need to know the other ones patients so I was wanting to take the combined form that the nurses use and separate it out by Doctor just for them. The building has 2 units (both units have a separate excel sheet, sheet1 and sheet2 with both MDs on both sheets). I was wanting to designate rows 1-10 for 1 unit and rows 14-25 for the other unit and create 2 new sheets, one for each MD that combines their patients to one sheet but still separates it based on what unit the patient is on. The macro would also need to not only combine the patients but delete the ones who are discharged and deleted from the original sheets. As of right now all I can do is separate the MDs patients with the following:

Sub CopyUT()
Dim bottomA As Integer
Dim x As Integer
bottomA = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row: x = 1

Dim c As Range
For Each c In Sheets("sheet1").Range("A1:A" & bottomA)
If c.Value = "UT" Then
c.EntireRow.copy Worksheets("sheet2").Range("A" & x)
x = x + 1
End If
Next c
Call CopyWC
End Sub


Sub CopyWC()
Dim bottomA As Integer
Dim x As Integer
bottomA = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row: x = 1

Dim c As Range
For Each c In Sheets("sheet1").Range("A1:A" & bottomA)
If c.Value = "WC" Then
c.EntireRow.copy Worksheets("sheet3").Range("A" & x)
x = x + 1
End If
Next c

End Sub

Also if possible, anytime new information is entered into the MD column, it would be great to have the macro automatically run to keep their forms constantly updated. If this is possible great but If not I'll work with what I can. All and any help is appreciated.

Ryan
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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