Forum Replies Created
-
AuthorPosts
-
jorgerod
Keymasterbenvindo, dutra!!!
espero que o forum te seja útil. o que quiseres partilhar, partilha, que o pessoal agradece.
fica bem.
jorgerod
Keymasteralbino,
experimenta este segmento de código, julgo que, adaptando, dará o resultado que pretendes.
diz qq coisa, ok?
sub teste()
dim lastrow as long
sheets(“folha1”).select
range(“u11:x12”).selectselection.copy
sheets(“folha2”).select
range(“a1”).select
if isempty(range(“a1”)) then
selection.pastespecial paste:=xlvalueselse
lastrow = sheets(“folha2”).range(“a65536”).end(xlup).row ‘
msgbox lastrow ‘
range(“a” & lastrow).offset(1, 0).select ‘
selection.pastespecial paste:=xlvaluesend if
end sub
relacionado com este assunto, podes ver muito mais e, talvez melhor, em:
fica bem.
jorgerod
Keymasteralbino,
podes também ver, é claro que para outros fins, o post que criei em 2006 (no blog exceler): http://exceler.blogspot.com/2006/10/vba-propriedade-offset.html
fica bem.
jorgerod
Keymasterboas,
tenta adaptar de um post que coloquei no site em 2008, talvez com a inclusão da formula offset. ter em atenção que as fórmulas estão em inglês e talvez tenham que ser convertidas para pt-pt ou pt-br.
o link do post: http://www.exceler.org/excel/formulas/230-excel-vlookup-right-a-value.html
fica bem.
jorgerod
Keymasteralbino,
julgo que o teu problema tem a ver com a utilização da função offset. tu tens: selection.end(xldown).offset(0, 0).select
ora, assim sendo, não passa de linha nem de coluna.
abaixo mostro as opções de offset (embora em inglês), para melhor compreensão:
offset
the offset property is the one that you will use the most with range to move around the sheet.to move one cell down (from b2 to b3): range(“b2”).offset(1,0).select
to move one cell to the right (from b2 to c2): range(“b2”).offset(0,1).select
to move one cell up (from b2 to b1): range(“b2”).offset(-1,0).select
to move one cell to the left (from b2 to a2): range(“b2”).offset(0,-1).selectto move one cell down from the selected cell:
activecell.offset(1,0).selectas you notice the first argument between the parentheses for offset is the number of rows and the second one is the number of columns. so to move from a1 to g6 you will need:
range(“a1”).offset(5,6).selectyou will use very often the following piece of code . it selects a cell plus 4 more to the right to be copied/pasted somewhere else:
range(activecell,activecell.offset(0,4)).copy
notice the comma after the first activecell and the double closing parentheses before the copy.(retirado de: excel macros (vba)
for beginners, intermediate and advanced users – peter – http://www.excel-vba.com/index.htm)jorgerod
Keymasteralbino,
se não te importas, coloca o código correcto aqui, para os “vindouros”, ok?
obrigado e 1 ab.
jorgerod
Keymasteralbino,
sem ter experimentado, julgo que o teu problema estará no controlo das células, é isto?
se for, talvez possas utilizar uma coisa parecida com isto:
dim r as range, cell as range
ary = array(range(“f7:f9”), range(“c17:c17”), range(“c22:c22”),range(“e22:e22”), range(“e28:e28”))
for i = lbound(ary) to ubound(ary)
for each cell in ary(i)
if cell.value= “” then
msgbox “preencha todos os campos.”, vbokonly, (“atenção”)
endif
next
next
exit sub
…experimenta e diz qq coisa, ok?
jorgerod
Keymasteralbino,
vê o que representam os erros 424 e 3011 em: http://scriptbrasil.com.br/forum/lofiversion/index.php/t50724.html
o primeiro diz respeito a falta de um formulário e o 2º tem a ver com o microsoft jet (http://www.google.pt/url?sa=t&rct=j&q=microsoft%20jet&source=web&cd=2&sqi=2&ved=0cduqfjab&url=http%3a%2f%2fsupport.microsoft.com%2fkb%2f239114&ei=mdwlt8cjksnh0qwpootocg&usg=afqjcneb7crgmi28pz-fwpzlzxw1uxnnyq).
jorgerod
Keymastercá vai o meu e-mail
de qq maneira, você pode anexar aqui, mas tem de usar o compressor zip, não o rar… se conseguir, dá a possibilidade de outros membros do forum poderem tentar resolver o seu problema…
jorgerod
Keymasteranexa aqui a tua planilha. pode ser que seja mais fácil, para nós vermos como será possível resolver o teu problema!
jorgerod
Keymasteranexa aqui o teu exemplo. É melhor para todos!
jorgerod
Keymasteralbino,
obrigado!! É sempre para colar 🙂
quanto mais se cola aqui, melhor e mais útil é para todos!!!
jorgerod
Keymasterproveniente de zack barresse (vba express), para adaptar:
option explicit
sub svme()
‘saves filename as value of a1 plus the current date
dim newfile as string, fname as string
‘ don’t use “/” in date, invalid syntax
fname = range(“a1″).value‘change the date format to whatever you’d like, but make sure it’s in quotes
newfile = fname & ” ” & format$(date, “mm-dd-yyyy”)‘ change directory to suit your pc, including user name
chdir _
“c:documents and settings user name desktop”activeworkbook.saveas filename:=newfile
end sub
jorgerod
Keymasterboas,
acho que (sem ter verificado), ao invés da função asc(), deveria ser a função chr():
senddlgitemmessage wparam, &h1324, em_setpasswordchar, chr(42), &h0
digo isto, porque a função asc(), dá o código ascii, ou seja exactamente o contrário do que se pretende:
chr(42) dá “*”
asc(“*”) dá 42podes experimentar. depois diz qq coisa, ok?
jorgerod
Keymaster -
AuthorPosts
EXCELer Tudo sobre EXCEL em Português