Excel 2003. Every month we do this. Therefore we think a macro would be ideal?? We export data to excel.)
We have three columns. (Patient ID Number, Patient Name, Medication). Sometimes Patient ID Numbers are blank although some are filled in for the same Patient Name. For example column B "Patient Name"----cells b6:b12 has the Patient Name, yet column A "Patient ID Number" cells a10:a12 are blank. How can we get the blanks filled in for the repective patient? And have this repeat for all the patients in the spreadsheet who are missing their Patient ID Numbers? I tried to attach a sample data spreadsheet of my issue but manage attachments would not open (white screen forever). Thanks in advance for your time and assistance!![]()
Last edited by kwrightcltc; 12-30-2011 at 03:32 AM. Reason: Issue SOLVED by ExcelGuru
Hi kwrightcltc
Welcome to the Forum!
You'll need code something like thisThis code will fill the SELECTED Column with the value from above. If you need help adapting please post a sample of your file.Sub FillColBlanks_Offset() 'by Rick Rothstein 2009-10-24 'fill blank cells in column with value above 'http://www.contextures.com/xlDataEntry02.html ' Select Column First Dim Area As Range, LastRow As Long On Error Resume Next LastRow = Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, _ LookIn:=xlFormulas).Row For Each Area In ActiveCell.EntireColumn(1).Resize(LastRow). _ SpecialCells(xlCellTypeBlanks).Areas Area.Value = Area(1).Offset(-1).Value Next End Sub
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Click the button in the attchment and tell me if it is what you are after?
If you are happy with the answer, please click the Star icon in the below left hand corner.
Good sites to start learning.
snb's VBA Help Files
Jerry Beaucaires Excel Assistant
J & R Excel Consultancy Services
How to post code correctly: Correct Code Posting
Is the Id in cell A9 is to be applied for a10:a12 and similarly further.
jaslake,
Thanks! It worked! I just found this forum and I am very impressed by such valuable knowledge. Thanks and I hope to be able to return the favor to the forum someday.
kwrightcltc
JapanDave,
Thanks! It worked! I just found this forum and I am very impressed by such valuable knowledge. Thanks and I hope to be able to return the favor to the forum someday.
kwrightcltc
kvsrinivasamurthy,
Thanks for your time and interest in my issue. It was SOLVED by the FORUMGURU and JapanDave. Thanks again for your time and interested in my issue. I hope to be of assistance to the Forum myself someday.
kwrightcltc
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks