Code: (Sorry for the lack of useful commenting. I only worked on this yesterday, so it was a bit thrown together).

Code:
-- ****************************************
-- * Library definitions                  *
-- ****************************************
local libTrust = LibStub("LibTrust-0.1")
local libRpc = LibStub("LibRpc-0.2")

-- ****************************************
-- * Constants                            *
-- ****************************************
NUM_MACRO_ICONS_SHOWN = 30;
NUM_ICONS_PER_ROW = 5;
NUM_ICON_ROWS = 6;
MACRO_ROW_HEIGHT = 36;
MACRO_ICON_ROW_HEIGHT = 36;

-- ****************************************
-- * Ace3 addon creation line             *
-- * - Only uses AceConsole ATM, though   *
-- *   the plan is to use AceGUI for the  *
-- *   GUI at some point                  *
-- ****************************************
MultiBoxMacro = LibStub("AceAddon-3.0"):NewAddon("MultiBoxMacro", "AceConsole-3.0")

-- ****************************************
-- * Command line setup                   *
-- * - Options are "show" or "display"    *
-- *   they both do the same thing        *
-- ****************************************
local options = {
    name = "MultiBoxMacro",
    handler = MultiBoxMacro,
    type = 'group',
    args = {
		display = {
			name = "display",
			type = "execute",
			func = "Display",
		},
		show = {
			name = "show",
			type = "execute",
			func = "Display",
		},
    },
}

-- ****************************************
-- * Display method                       *
-- * - Called by the command line option. *
-- *   Displays the window                *
-- ****************************************
function MultiBoxMacro:Display()
    -- Show the window.
    MultiBoxMacroFrame:Show();
end

function MultiBoxMacro:OnInitialize()
    -- Register the command line options
    LibStub("AceConfig-3.0"):RegisterOptionsTable("MultiBoxMacro", options, {"multiboxmacro", "mbm"})
end

-- Macro Display functions

MultiBoxMacro.cachedMacros = {};
MultiBoxMacro.selectedMacro = -1;

function MultiBoxMacro:ClearMacroButtons()
	for i=1,36 do
		local macroID = i;
		getglobal("MultiBoxMacroButton"..macroID.."ID"):SetText(macroID);
		local macroButton = getglobal("MultiBoxMacroButton"..macroID);
		local macroIcon = getglobal("MultiBoxMacroButton"..macroID.."Icon");
		local macroName = getglobal("MultiBoxMacroButton"..macroID.."Name");

		macroButton:SetID(macroID);
		macroIcon:SetTexture("");
		macroName:SetText("");
		macroButton:Enable();
		macroButton:SetChecked(0);
	end

	self:SetSelectedMacro(-1);

   	MultiBoxMacroFrameSelectedMacroName:SetText("");
	MultiBoxMacroFrameText:SetText("");
	MultiBoxMacroFrameSelectedMacroButton:SetID(0);				
   	MultiBoxMacroFrameSelectedMacroButtonIcon:SetTexture("");
end

function MultiBoxMacro:SetMacroButtons(macros)
	for i=1,36 do
		local macroID = i;
		getglobal("MultiBoxMacroButton"..macroID.."ID"):SetText(macroID);
		local macroButton = getglobal("MultiBoxMacroButton"..macroID);
		local macroIcon = getglobal("MultiBoxMacroButton"..macroID.."Icon");
		local macroName = getglobal("MultiBoxMacroButton"..macroID.."Name");
		
		if macros[i] ~= 0 and macros[i] ~= -1 then
			macroButton:SetID(macroID);
			macroIcon:SetTexture(macros[i].texture);
			macroName:SetText(macros[i].name);
			macroButton:Enable();
			-- Highlight Selected Macro
			if ( i == MultiBoxMacro.selectedMacro ) then
				macroButton:SetChecked(1);
    			MultiBoxMacroFrameSelectedMacroName:SetText(macros[i].name);
				MultiBoxMacroFrameText:SetText(macros[i].body);
				MultiBoxMacroFrameSelectedMacroButton:SetID(macroID);				
    			MultiBoxMacroFrameSelectedMacroButtonIcon:SetTexture(macros[i].texture);
			else
				macroButton:SetChecked(0);
			end
		else
			macroButton:SetID(macroID);
			macroIcon:SetTexture("");
			macroName:SetText("");
			macroButton:Enable();
			macroButton:SetChecked(0);
		end
	end
	
	self:UpdateNewButtonStatus();
end

function MultiBoxMacro:UpdateNewButtonStatus()
	self:UpdateNewAccountButtonStatus();
	self:UpdateNewCharacterButtonStatus();
end

function MultiBoxMacro:UpdateNewAccountButtonStatus()
	for i=1,18 do
		if self.cachedMacros[self:GetNameFromTab()][i] == 0 then
			MultiBoxMacroNewAccountButton:Enable();
			return;
		end
	end	

	MultiBoxMacroNewAccountButton:Disable();
end

function MultiBoxMacro:UpdateNewCharacterButtonStatus()
	for i=1,18 do
		if self.cachedMacros[self:GetNameFromTab()][i] == 0 then
			MultiBoxMacroNewCharacterButton:Enable();
			return;
		end
	end	

	MultiBoxMacroNewCharacterButton:Disable();
end

-- Player Macro functions

function MultiBoxMacro:LoadPlayerMacros()
	local numAccountMacros, numCharacterMacros = GetNumMacros();
	local numMacros = 0;
	
	self.cachedMacros["player"] = {}

	for j=0, 18, 18 do
		if ( j == 0 ) then
			numMacros = numAccountMacros;
		else
			numMacros = numCharacterMacros;
		end
	
		for i=1, 18 do
			if i <= numMacros then
				local thename, thetexture, thebody, theisLocal = GetMacroInfo(i+j);
				--self:Print("Got macro info for"..thename);
				self.cachedMacros["player"][i+j] = {
					name = thename,
					texture = thetexture,
					body = thebody,
					isLocal = theisLocal,
				};
			else
				self.cachedMacros["player"][i+j] = 0;
			end
		end
	end
	
	self:SetMacroButtons(self.cachedMacros["player"]);
end

-- Party Macro functions

function MultiBoxMacro:LoadPartyMacros(member)
	libRpc:RemoteCall(member, MBM_RPC_NumMacros, "GetNumMacros");
end

function MultiBoxMacro:EndLoadPartyMacros(member)
	self:SetMacroButtons(self.cachedMacros[member]);
end

-- Selected macro management

function MultiBoxMacro:SetSelectedMacro(index)
	if index == -1 then
		MultiBoxMacroDeleteButton:Disable();
		MultiBoxMacroSaveButton:Disable();
		MultiBoxMacroEditButton:Disable();
	else
		MultiBoxMacroDeleteButton:Enable();
		MultiBoxMacroSaveButton:Enable();
		MultiBoxMacroEditButton:Enable();
	end
	
	MultiBoxMacroPopupFrame:Hide();
	self.selectedMacro = index;
end

-- RPC callbacks

function MBM_RPC_NumMacros(info)
	local numAccountMacros, numCharacterMacros = unpack(info.rval);
	
	local numMacros = 0;
	
	MultiBoxMacro.cachedMacros[info.target] = {}

	for j=0, 18, 18 do
		if ( j == 0 ) then
			numMacros = numAccountMacros;
		else
			numMacros = numCharacterMacros;
		end
	
		for i=1, 18 do
			if i <= numMacros then
				MultiBoxMacro.cachedMacros[info.target][i+j] = -1;
			else
				MultiBoxMacro.cachedMacros[info.target][i+j] = 0;
			end
		end
	end
	
	for j=0, 18, 18 do
		if ( j == 0 ) then
			numMacros = numAccountMacros;
		else
			numMacros = numCharacterMacros;
		end
	
		for i=1, 18 do
			if i <= numMacros then
				libRpc:RemoteCall(info.target, MBM_RPC_MacroInfo, "GetMacroInfo", i+j);
			end
		end
	end
end

function MBM_RPC_MacroInfo(info)

	local id = unpack(info.args);
	local thename, thetexture, thebody, theisLocal = unpack(info.rval);

	MultiBoxMacro.cachedMacros[info.target][id] = {
					name = thename,
					texture = thetexture,
					body = thebody,
					isLocal = theisLocal,
				};

	if MultiBoxMacro:GetNameFromTab() == info.target then
		MultiBoxMacro:SetMacroButtons(MultiBoxMacro.cachedMacros[info.target]);
	end

	for i=1,36 do
		if MultiBoxMacro.cachedMacros[info.target][i] == -1 then
			return;
		end
	end
	
	if MultiBoxMacro:GetNameFromTab() == info.target then
		MultiBoxMacro:EndLoadPartyMacros(info.target)
	end
end

function MBM_RPC_CreateMacro(info)
	local id = unpack(info.rval);
	local thename, icon, thebody, theisLocal = unpack(info.args);
	local thetexture = GetMacroIconInfo(icon);
	
	MultiBoxMacro.cachedMacros[info.target][id] = {
					name = thename,
					texture = thetexture,
					body = thebody,
					isLocal = theisLocal,
				};
				
	MultiBoxMacro:SetSelectedMacro(id);
	MultiBoxMacro:LoadPartyMacros(info.target);
end

-- Main Frame methods

function MultiBoxMacro:Frame_OnShow()
	self.Tab = 0;
	MultiBoxMacro:OnTabChange(1);
	
	MultiBoxMacroFrameTab1:SetText(UnitName("player"));
	
	for i=1,4 do
		if UnitExists("party"..i) then
			if libTrust:IsAllowed(UnitName("party"..i)) then
				getglobal("MultiBoxMacroFrameTab"..(i+1)):Show();
				getglobal("MultiBoxMacroFrameTab"..(i+1)):SetText(UnitName("party"..i));
			else
				getglobal("MultiBoxMacroFrameTab"..(i+1)):Hide();
			end
		else
			getglobal("MultiBoxMacroFrameTab"..(i+1)):Hide();
		end
	end
end

function MultiBoxMacro:Frame_OnHide()
	MultiBoxMacroPopupFrame:Hide();
	self.cachedMacros = {};
end

--Tab methods

MultiBoxMacro.Tab = 1

function MultiBoxMacro:OnTabChange(selectedTab)
	if selectedTab ~= self.Tab then

		self.Tab = selectedTab

		if self.Tab == 1 then
			MultiBoxMacroRefreshButton:Disable();
		else
			MultiBoxMacroRefreshButton:Enable();
		end
		
		self:ClearMacroButtons();
		
		if self.Tab == 1 then
			if self.cachedMacros["player"] == nil then
				self:LoadPlayerMacros();
			else
				self:SetMacroButtons(self.cachedMacros["player"]);
			end
			MultiBoxMacroFrameCharacterMacroText:SetText(UnitName("player").."'s Macros");
		else
			if self.cachedMacros[self:GetNameFromTab()] == nil then
				self:LoadPartyMacros(self:GetNameFromTab());
			else
				self:SetMacroButtons(self.cachedMacros[self:GetNameFromTab()]);
			end
			MultiBoxMacroFrameCharacterMacroText:SetText(self:GetNameFromTab().."'s Macros");
		end
	end
end

function MultiBoxMacro:GetNameFromTab()
	if self.Tab == 1 then
		return "player";
	else
		return UnitName("party"..(self.Tab-1));
	end
end