excel - How to choose manually where to insert a value/picture -


what looking way in vba macro, have setting, cell activated (wherever in sheet), there macro insert specific value or picture.

is way in doing this?

i know how specify range in macro picture should inserted, inserted manually have chosen via mouse. vba code:

sub importera_bilder()     dim mainworkbook workbook     dim sh worksheet     dim ws2 worksheet     dim ws worksheet     dim sh2 worksheet      set sh = sheets("kundinformation")     set ws2 = sheets("partner_information")     set ws = sheets("kalkyl")     set sh2 = sheets("start")       set mainworkbook = activeworkbook     sheets("projektunderlag").activate     folderpath = ws2.range("b21").value     set fso = createobject("scripting.filesystemobject")     nooffiles = fso.getfolder(folderpath).files.count     set listfiles = fso.getfolder(folderpath).files     each fls in listfiles        strcompfilepath = folderpath & "\" & trim(fls.name)         if strcompfilepath <> ""             if (instr(1, strcompfilepath, "jpg", vbtextcompare) > 1 _             or instr(1, strcompfilepath, "jpeg", vbtextcompare) > 1 _             or instr(1, strcompfilepath, "png", vbtextcompare) > 1)                  counter = counter + 1                   'sheets("object").range("a" & counter).value = fls.name                   'sheets("projektunderlag").range("m" & counter).columnwidth = 10                 'sheets("projektunderlag").range("m" & counter).rowheight = 13                 'sheets("projektunderlag").range("m" & counter).activate                 call insert(strcompfilepath, counter)                 sheets("projektunderlag").activate             end if         end if     next mainworkbook.save end sub  function insert(picpath, counter) 'msgbox picpath     activesheet.pictures.insert(picpath)         .shaperange             .lockaspectratio = msotrue             .width = 270             .height = 230         end          activesheet.range("m269").select         .left = activesheet.range("m269").left         .top = activesheet.range("m269").top         .placement = 1         .printobject = true     end end function 

you want use activecell property.

for instance if wanted place number 900 in cell have selected vba be:

sub insert900()     activecell.value = 900 end sub 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -