LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 829
Default Help merging two VBA codes

"arceaf" wrote:
I'm having a bit of difficulty merging two different
VBA functions into one button.


Please explain the "difficulty". I presume you already tried copying and
pasting the text of second macro into the text of the first macro. In what
way does that not do what you expect?


"arceaf" wrote:
This the the button code:

[....]
And this is the other VBA code:


Why "merge" the code at all? Why not simply call the second macro at the
end of the first macro? See below. In what way does that not do what you
expect?

Private Sub CommandButton2_Click()
With Sheets("Recommendations Calc").Range("A" & Rows.Count).End(xlUp)
..Offset(1, 0).Value = Sheets("Decision Matrix").Range("C2").Value
..Offset(1, 1).Value = Sheets("Decision Matrix").Range("h55").Value
..Offset(1, 4).Value = Sheets("Decision Matrix").Range("I55").Value
'<--call the macro to delete the dup. and put the last data entry.
deletedup
End With
thebigcopy ' <-- added
End Sub

(Aside: I would put the call to "deletedup" after End With.)

PS: "thebigcopy" changes the active worksheet. It might be prudent to
modify it so that it goes back to the original active worksheet. To wit:

Sub thebigcopy()
Dim oldWS as Worksheet
Set oldWS = Activesheet ' <-- remember initial active worksheet
[....]
oldWS.Activate ' <-- restore initial active worksheet
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some help with codes Tom Excel Discussion (Misc queries) 2 August 16th 07 01:09 AM
When merging information not merging correctly Bridgett Excel Worksheet Functions 0 December 9th 05 10:12 PM
Merging Two Codes Into one code LoveCandle[_18_] Excel Programming 11 November 27th 05 04:13 AM
re : Help Need on my codes ddiicc Excel Programming 2 August 17th 05 05:37 AM
Sorting, Merging, and Re-merging Abi Excel Worksheet Functions 2 June 15th 05 08:21 PM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"