Hi All,
i'm struggling on this lookup,
Lookup based on Empl ID images are in folder.
gave a folder path : C:\Users\raja\Pictures\Empl Photos
Photo name Must in Empl ID format: (e.g) 10001
If it's possible.... Please help
Hi All,
i'm struggling on this lookup,
Lookup based on Empl ID images are in folder.
gave a folder path : C:\Users\raja\Pictures\Empl Photos
Photo name Must in Empl ID format: (e.g) 10001
If it's possible.... Please help
Refer link will help you.HTML Code:
atul
If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.
Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".
The link above from @avk inserts images in a cell without VBA and looks up images already embedded in the workbook
This method inserts images using VBA and looks up those images in a folder dynamically
Both methods work well
1. Add an extra image in your folder with name DefaultImage.jpg
- this is the image used if filename in cell C4 does not exist
- prevents the code failing
2. Insert the code below in the sheet's module
- right-click on sheet tab
- select View Code
- paste code below into code window
- {Alt}{F11} to return to Excel
3. Save as macro enabled workbook
4. Test
- amend the value in B4 (which drives formula in C4)
- the image in cell E2 changes whenever value in C4 changes
5. 10002 in cell B4 creates this path : C:\Users\raja\Pictures\Empl Photos\Raj -10002.jpg
Please Login or Register to view this content.
Last edited by kev_; 02-16-2019 at 04:09 AM. Reason: Code apended to delete previous photo
Click *Add Reputation to thank those who helped you. Ask if anything is not clear
thank for reply
This code copy & paste to my Main work Book that's not working... pls Check this
pasted as per you said
How can anyone check anything when all you tell them is "that's not working"?
More detailed information, please.
- Does the code run?
- Does it run but do nothing?
- Does it produce error messages? If so, what do the messages say?
- Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
- Does it hang?
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
i paste on my main workbook and run the macro nothing is happen. my old macro running partially.
if you see my attachment understand my points
You have not posted the workbook with the code pasted from post #3. You will need to do so if you want help troubleshooting this.
@ Raj.xls
- I attached a workbook which contain the code
Have you opened the workbook and tested it?
Sorry forgot to attach
Hi Kev,
i tested it's showing debug in this line
Set Pic = ActiveSheet.Pictures.Insert(FullPath)
I explain clearly, 1st kev create a code and attach i tried its showing debug in this line Set Pic = ActiveSheet.Pictures.Insert(FullPath).
And i copied that and paste in my main workbook and run the macro previous macro not run (C3. clear-content ) this line . That's why i attached My Main Workbook.
Attachment #9
Last edited by Raj.xls; 02-16-2019 at 06:57 AM.
I think I made a small mistake
should bePlease Login or Register to view this content.
Please Login or Register to view this content.
Hi Kev,
Thanks for Reply. That's working really you are great.
One small request,
My actual purpose this workbook is empl login entry, already i have one macro in same sheet for capture (id, name & Login time)
And added your macro & run its showing a popup (ambiguous name detected: worksheet change)
attached Main workbook
how i can run both the macros in same worksheet.. please guide me.
Last edited by Raj.xls; 02-17-2019 at 03:17 AM.
Try combining the 2 macros like this
Please Login or Register to view this content.
You do not need to do this but (to be consistent) consider..
EITHER amending
toPlease Login or Register to view this content.
OR amendingPlease Login or Register to view this content.
toPlease Login or Register to view this content.
Please Login or Register to view this content.
Hi Kev
i tried, its showing a popup like this (sub or function Not defined)
Please fix
Is procedure InsertPic still in your code? (looks like VBA cannot find it)
If you cannot fix it then post your code for me to check
Use code tags - click on # icon (above post window) and paste code between the tags
[ CODE] paste code here [/CODE]
Last edited by kev_; 02-18-2019 at 06:43 AM.
please attach the file with code
Anyone help for This
Actual purpose is if enter Empl ID, Date, Login time Etc. information i'll update in next sheet at the same time image display on sheet from folder. i have code BUT
i don't know what is wrong in CODE
Please correct where its wrong
Please Login or Register to view this content.
This work?
Please Login or Register to view this content.
This work? I wasn't able to test it.
Please Login or Register to view this content.
Hi Jme
I ran a command it's showing error
Compile error
Only comments may appear after end sub, end function or end property.
Remove
Please Login or Register to view this content.
after removed Option explicit
Data was updated But Not showing a image what i can do for that ??
@Raj.xls
For information : Option Explicit
- Option Explicit is placed at the TOP of the module (before any procedures)
- it forces you to always declare variables
Your questions
You were given code, you tested it, it worked. You then asked for 2 bits of code to be combined
Why did you not do what I suggested in post#14? instead of adding extra precudures?
It should work using post#14 version of Worksheet_Change
- test with only Worksheet_Change and InsertPic procedures in the module
- if it does not work, post that code and I will look at it for you
This is all you should have in the module
Please Login or Register to view this content.
Last edited by kev_; 02-19-2019 at 08:49 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks