Respostas criadas no fórum
-
AutorArtigos
-
jorgerod
Administradormcjota,
o que está no link, é o seguinte:
option explicit
private declare function callwindowproc lib “user32.dll” alias “callwindowproca” ( _
byval lpprevwndfunc as long, byval hwnd as long, byval msg as long, byval wparam as long, _
byval lparam as long) as longprivate declare function setwindowlong lib “user32.dll” alias “setwindowlonga” ( _
byval hwnd as long, byval nindex as long, byval dwnewlong as long) as longprivate declare function findwindow lib “user32” alias “findwindowa” ( _
byval lpclassname as string, byval lpwindowname as string) as longprivate const gwl_wndproc = -4
private const wm_mousewheel = &h20aprivate hwnd_userform as long
private lngwndproc as long‘this traps the mousewheel scroll message as it’s sent to your form by wiindows,
‘then it calls the procedure in the form’s code module in order to scroll the list
private function windowproc(byval lwnd as long, byval lmsg as long, byval wparam as long, byval lparam as long) as long
dim mousekeys as long
dim rotation as longif lmsg = wm_mousewheel then
mousekeys = wparam and 65535
rotation = wparam / 65536‘you will have to replace “userform1” in the following line, with the name of your form 😉
userform1.combobox1_mousewheel rotation
end if
windowproc = callwindowproc(lngwndproc, lwnd, lmsg, wparam, lparam)end function
public sub wheelhook(clientform as userform)
hwnd_userform = findwindow(“thunderdframe”, clientform.caption)
lngwndproc = setwindowlong(hwnd_userform, gwl_wndproc, addressof windowproc)
end subpublic sub wheelunhook()
dim lret as long
lret = setwindowlong(hwnd_userform, gwl_wndproc, lngwndproc)
end sube, a seguir:
‘***************************************************
‘created by member timbo @ xtremevbtalk.com
‘adapted from the listbox solution by mathieu plante
‘***************************************************‘#############################################################
‘don’t forget to substitute “combobox1” with your control name
‘#############################################################option explicit
‘flag to determine if the control is currently hooked
private blnhooked as booleanprivate sub combobox1_mousemove(byval button as integer, byval shift as integer, byval x as single, byval y as single)
‘create the hook when the mouse is over the control
combobox1_hook
end subprivate sub userform_mousemove(byval button as integer, byval shift as integer, byval x as single, byval y as single)
‘destroy the hook when the mouse is not over the control
combobox1_unhook
end subprivate sub userform_queryclose(cancel as integer, closemode as integer)
‘ensure the hook is destroyed before the form closes
combobox1_unhook
end subprivate sub userform_deactivate()
‘destroy the hook if another window takes the focus
combobox1_unhook
end subprivate sub combobox1_hook()
‘only hook the control if it is not already hooked
if not blnhooked then
wheelhook me
blnhooked = true
end if
end subprivate sub combobox1_unhook()
‘only destroy hook the control if it is already hooked
if blnhooked then
wheelunhook
blnhooked = false
end if
end sub‘custom method to execute the mousewheel scroll action
public sub combobox1_mousewheel(byval rotation as long)
dim lngnewindex as long
static intcounter as integer‘a little retarding routine to make the mousewheel less sensitive!
intcounter = intcounter + 1
if not intcounter = 3 then exit sub
intcounter = 0with me.combobox1
if rotation lngnewindex then .listindex = lngnewindex
else
if not .listindex <= -1 then .listindex = .listindex – 1
end if
end withend sub
jorgerod
Administradoracho que já te deram uma resposta noutro local onde colocaste esta questão. no entanto, vê em:
http://www.xtremevbtalk.com/showthread.php?t=254921
pode ser que te ajude.
fica bem.
10 de Outubro de 2012 às 15:06 em resposta a: Achar o maior de e apresentar o valor noutra tabel #2005jorgerod
Administradorsupondo que tens a tua tabela referente ao mês a partir de a1, terias a1= 5; b1=5; c1=30 e d1=40 fórmulas em g1, h1 e i1, dando os 3 valores mais elevados: g1 – =maior(a1:d1;1); h1 – =maior(a1:d1;2) e i1 – =maior(a1:d1;3)
a mesma coisa para a liha dos acumulados.
não sei se me fiz entender. diz qq coisa, ok?
fica bem.
jorgerod
Administradorainda bem que conseguiste. obrigado por colocares aqui o teu código! 🙂
jorgerod
Administradorboas,
talvez assim: textbox2.value = replace(textbox1.value, ” “, “_”)
atenção: não testei.
vê a função replace (vba), em: http://www.techonthenet.com/excel/formulas/replace_vba.php
jorgerod
Administrador.workingdirectory=”d:”
É isto? diz, para ficar mais compreensível, em conjunto com o código que forneceste abaixo.
também se pode ver a seguinte peça de código, que fará sensivelmente a mesma coisa, ou seja, criar um shortcut no desktop: http://www.ozgrid.com/forum/showthread.php?t=34910
obrigado e fica bem.
jorgerod
Administradorcaro mcjota,
ainda bem que conseguiste resolver o teu problema. É para isso que serve o exceler 🙂
olha, podes postar aqui o código todo do teu módulo, para ser mais perceptível o que pretendias?
obrigado e fica bem!!!!
jorgerod
Administradorpodes ver melhor o que eu escrevi, em: http://www.excelfunctions.net/vba-variables-and-constants.html
espero que te sirva a leitura.
fica bem.
jorgerod
Administradorconstant: o conteúdo não pode ser modificado. É invariável, por isso é que é chamado constant!
variable: o conteúdo pode ser modificado. É modificável.
jorgerod
Administradorgpedroso,
vê resposta possível em: http://www.get-digital-help.com/2007/12/05/excel-find-closest-value/
fica bem e diz qq coisa, ok?
jorgerod
Administradorjkf,
podes explicar um pouco melhor e, se possível, com anexo?
jorgerod
Administradorainda bem que resultou! 🙂
um abraço.
jorgerod
Administradorpatropi,
vê em : http://superuser.com/questions/204925/excel-find-a-subset-of-numbers-that-add-to-a-given-total
vê também, no site do mvp tushar metha: http://www.tushar-mehta.com/excel/templates/match_values/index.html
o site deste mvp, pode ser visto no tabulador “favoritos”: http://www.exceler.org/favoritos/1.html
pode ser que te ajude.
jorgerod
Administradoroutra hipótese para o footer:
sub myfooter()
dim strftr as string, rng as range, sh as worksheet, c as range
set sh = worksheets(“folha1”)
set rng = sh.range(“a35:ah45 “)for each c in rng
strftr = strftr & c & ” ”
next cactivesheet.pagesetup.leftfooter = strftr
end subjorgerod
Administradoralbino,
experimenta, para o início: http://office.microsoft.com/en-us/excel-help/repeat-specific-rows-or-columns-on-every-printed-page-ha010342842.aspxpara o final:
sub macro1()
dim strftr as string
strftr = range(“a35”) & vblf & range(“a36”) & vblf & range(“a37”) ‘ isto é um exemplo apenas para 3 linhas…
activesheet.pagesetup.leftfooter = strftr
end sub -
AutorArtigos
EXCELer Tudo sobre EXCEL em Português