LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Finding the same unique identifier in multiple worksheets

Hello

I have been using this code for about a year now, adapting it to suit
different workbooks and situations. However, I want to try and make it a
little more foolproof so that I can share it with other staff in our
organisation.

The code is as follows:

Sub RespondedToForm()
' Macro created to compare User IDs between the "Sent the Form"
' worksheet (on which this macro is run) and the "Responded to Form" worksheet

Dim c As Range
Dim findC As Variant

For Each c In ActiveSheet.Range("E2:E158")
If Not c Is Nothing Then
Set findC = Worksheets("Responded to form").Cells _
.Find(c.Value, LookIn:=xlValues)
If Not findC Is Nothing Then
ActiveSheet.Range("Q" & c.Row).Cells.Value = "Yes"
End If
End If
Next
End Sub


As you can see, this macro will check to see whether a User Id appearing in
the active sheet range E2 to E158 also appears in the "Responded to Form"
worksheet and if so, it places the text "Yes" in the corresponding row cell
at Column Q of the active worksheet.

I have always changed the ranges, worksheet names and text within the code
to suit my needs. However, I now want to be able to get other staff to use
this macro without the need for them to have to play with the code.

Ideally, I would like to design a user form that asks the user to specify
the: (i) worksheets being compared, (ii) ranges to compare, (iii) column in
which the text is to be added, (iv) actual text to be added.

I did try using a Do Until Loop with the IsEmpty command, but ran into
problems.

I'm no expert with VBA, but I know enough to be dangerous. I can also design
the user form, but getting the coding right is where I'm having problems.
However, I would be happy to consider other suggestions if this could be done
without the need of a user form, as I am unsure how transferable the user
form would be from one workbook to another when staff needed to use the macro
in different workbooks.

Hope this makes sense!

Joe.


--
If you can measure it, you can improve it!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine data from 2 worksheets using unique identifier CathyW Excel Worksheet Functions 0 March 23rd 06 02:06 AM
Unique identifier Steve Barnett Excel Discussion (Misc queries) 19 January 6th 06 11:26 AM
Unique identifier Steve Barnett Excel Worksheet Functions 18 January 6th 06 11:26 AM
Unique identifier Steve Barnett Excel Programming 18 January 6th 06 11:26 AM
Unique Identifier? RPIJG[_3_] Excel Programming 1 May 11th 04 05:36 PM


All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"