vba - Multi Macro Communication -



vba - Multi Macro Communication -

i attempting self-teach myself great world of macro coding in vba have come across stumbling block when trying process 3 macros ideally process 1 code seems far complicated me @ stage.

what need convert info date format mm/dd/yyyy uk date format dd.mm.yyyy , changing / . @ same time ideally overwriting original data.

this have in separate modules:

sub fixformat() 'display message alternative if date formats 'included in info msgbox "us date formats included", vbquestion + vbyesno, "addresses" if response = yes msgbox "delimit process needed", vbokonly, "addresses" if response = no msgbox "end", vbokonly end end sub

and

sub fixdates() dim cell range dim lastrow long lastrow = range("a" & rows.count).end(xlup).row each cell in range("a1:a" & lastrow) if instr(cell.value, ".") <> 0 cell.value = regexreplace(cell.value, _ "(\d{2})\.(\d{2})\.(\d{4})", "$3.$2.$1") end if if instr(cell.value, "/") <> 0 cell.value = regexreplace(cell.value, _ "(\d{2})/(\d{2})/(\d{4})", "$3.$1.$2") end if cell.numberformat = "yyyy-mm-d;@" next end sub function regexreplace(byval text string, _ byval replace_what string, _ byval replace_with string) string dim re object set re = createobject("vbscript.regexp") re.pattern = replace_what re.global = true regexreplace = re.replace(text, replace_with) end function

is there way without having run 2 separate macros?

yes, can call subroutine want run result of message box.

sub fixformat() 'display message alternative if date formats 'included in info if msgbox("us date formats included", vbquestion + vbyesno, "addresses") = 6 msgbox "delimit process needed", vbokonly, "addresses" phone call fixdates else msgbox "end", vbokonly end if end sub

see link more info on msgbox function: http://msdn.microsoft.com/en-us/library/139z2azd(v=vs.90).aspx

vba date excel-vba formatting

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -