Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2000: Need Macro to Print Form for Each Selected Record

Status
Not open for further replies.

LINSEY

Technical User
Sep 5, 2003
35
US
I have a spreadsheet with records sorted by Style & Version:

STYLE[tab][tab]VERSION[tab][tab]COLOR[tab][tab]WEIGHT
LYW029[tab][tab]000[tab][tab][tab]Carbon[tab][tab][tab]12.0
LYW029[tab][tab]001[tab][tab][tab]Carbon[tab][tab][tab]11.5
LYW029[tab][tab]002[tab][tab][tab]Carbon[tab][tab][tab]11.0
MDE019[tab][tab]000[tab][tab][tab]Authentic[tab][tab][tab]12.0
LAB089[tab][tab]000[tab][tab][tab]Midnight[tab][tab][tab]11.0

Another spreadsheet contains a form that is populated when the "Style" & "Version" are typed in.

I need to highlight certain styles/versions on the 1st spreadsheet, click a "button", and have the style & version populated on the form and print for each style/version.

I think I need to use a macro for this, but I'm not sure how to use the "record macro" function to do it.

Please help!

Linsey
 
Pseudo code

Code:
Sub Print_Records()
Dim mStyle as string, mVersion as string, fWB as workbook
set fWB = Workbooks("Full Name & Path of the workbook with the form").open
thisworkbook.activate
for each c in selection
  mStyle = c.text
  mVersion = c.offset(0,1).text
  with fWB.sheets("Sheet With Form")
      .range("Address of Style Cell").value = mStyle
      .range("Address of Version Cell").value = mVersion
      .print
  end with
next
fWB.close savechanges:=false
end sub
  
This should work - you don't need to highlight style ANDversion - just the STYLE cells - it'll pickup the version from the row

Rgds, Geoff
[i][blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue][/i]
Want the [b][red]best[/red][/b] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top