+ Reply to Thread
Results 1 to 7 of 7

Thread: how to copy paste "patients id #" to where it is blank

  1. #1
    Registered User
    Join Date
    12-27-2011
    Location
    Upstate, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question how to copy paste "patients id #" to where it is blank

    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

  2. #2
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: how to copy paste "patients id #" to where it is blank

    Hi kwrightcltc

    Welcome to the Forum!

    You'll need code something like this
    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
    This code will fill the SELECTED Column with the value from above. If you need help adapting please post a sample of your file.
    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.

  3. #3
    Valued Forum Contributor JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    779

    Re: how to copy paste "patients id #" to where it is blank

    Click the button in the attchment and tell me if it is what you are after?
    Attached Files Attached Files
    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

  4. #4
    Valued Forum Contributor
    Join Date
    07-20-2011
    Location
    mysore
    MS-Off Ver
    Excel 2003
    Posts
    421

    Re: how to copy paste "patients id #" to where it is blank

    Is the Id in cell A9 is to be applied for a10:a12 and similarly further.

  5. #5
    Registered User
    Join Date
    12-27-2011
    Location
    Upstate, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: how to copy paste "patients id #" to where it is blank

    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

  6. #6
    Registered User
    Join Date
    12-27-2011
    Location
    Upstate, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: how to copy paste "patients id #" to where it is blank

    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

  7. #7
    Registered User
    Join Date
    12-27-2011
    Location
    Upstate, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: how to copy paste "patients id #" to where it is blank

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0