Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Data validation

mac,

This should work for you. Make sure the worksheet in question is active
before you run it, and change the cell reference "A1" to the appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I select the
list the data changes. Can anyone help me set up a macro to select each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac

  #2   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Data validation

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I explained
it. My list is on the same sheet it goes from Q3:q431. I would like to have
it lookup for first row(q3) paste it into d1 and then print it. Then go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is active
before you run it, and change the cell reference "A1" to the appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I select the
list the data changes. Can anyone help me set up a macro to select each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Data validation

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I explained
it. My list is on the same sheet it goes from Q3:q431. I would like to have
it lookup for first row(q3) paste it into d1 and then print it. Then go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is active
before you run it, and change the cell reference "A1" to the appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I select the
list the data changes. Can anyone help me set up a macro to select each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac

  #4   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Data validation

I am getting an error "Compile error: Invalid outside procedure. Thamk you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I explained
it. My list is on the same sheet it goes from Q3:q431. I would like to have
it lookup for first row(q3) paste it into d1 and then print it. Then go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is active
before you run it, and change the cell reference "A1" to the appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I select the
list the data changes. Can anyone help me set up a macro to select each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Data validation

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac





  #6   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Data validation

Hello,
I really feel stupid. I have done the sub & end Sub, now i get the message
"compile error: for without next". As ypu can tell I am a novice at macros,
so any help you give me is greatly appreciated.
--
thank you mac


"Chip Pearson" wrote:

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Data validation

post current code...

--
Tim Williams
Palo Alto, CA


"mac" wrote in message ...
Hello,
I really feel stupid. I have done the sub & end Sub, now i get the message
"compile error: for without next". As ypu can tell I am a novice at macros,
so any help you give me is greatly appreciated.
--
thank you mac


"Chip Pearson" wrote:

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac






  #8   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Data validation

Here it is. Thank you

Sub Sheet2()
Dim cell As Range
For Each cell In Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("b3:e18").PrintOut
End Sub
--
thank you mac


"Tim Williams" wrote:

post current code...

--
Tim Williams
Palo Alto, CA


"mac" wrote in message ...
Hello,
I really feel stupid. I have done the sub & end Sub, now i get the message
"compile error: for without next". As ypu can tell I am a novice at macros,
so any help you give me is greatly appreciated.
--
thank you mac


"Chip Pearson" wrote:

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data validation

Sub PrintSheet2()
Dim cell As Range
For Each cell In Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("b3:e18").PrintOut
Next Cell '<-- added
End Sub

mac wrote:

Here it is. Thank you

Sub Sheet2()
Dim cell As Range
For Each cell In Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("b3:e18").PrintOut
End Sub
--
thank you mac

"Tim Williams" wrote:

post current code...

--
Tim Williams
Palo Alto, CA


"mac" wrote in message ...
Hello,
I really feel stupid. I have done the sub & end Sub, now i get the message
"compile error: for without next". As ypu can tell I am a novice at macros,
so any help you give me is greatly appreciated.
--
thank you mac


"Chip Pearson" wrote:

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac







--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Data validation

Sorry so long to get back, was sick. I just want to thank you all for the
help you gave me. I works like a charm. Again thank you so much.
--
thank you mac


"Dave Peterson" wrote:

Sub PrintSheet2()
Dim cell As Range
For Each cell In Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("b3:e18").PrintOut
Next Cell '<-- added
End Sub

mac wrote:

Here it is. Thank you

Sub Sheet2()
Dim cell As Range
For Each cell In Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("b3:e18").PrintOut
End Sub
--
thank you mac

"Tim Williams" wrote:

post current code...

--
Tim Williams
Palo Alto, CA


"mac" wrote in message ...
Hello,
I really feel stupid. I have done the sub & end Sub, now i get the message
"compile error: for without next". As ypu can tell I am a novice at macros,
so any help you give me is greatly appreciated.
--
thank you mac


"Chip Pearson" wrote:

You need to put Tom's code within a procedure. E.g.,

Sub AAA()
' Tom's code
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"mac" wrote in message
...
I am getting an error "Compile error: Invalid outside procedure. Thamk
you
for the time to help me.
--
thank you mac


"Tom Ogilvy" wrote:

something like this for example.

Dim cell as Range
for each cell in Range("Q3:Q431")
Range("D1").Value = cell.Value
' change next line to reflect the range to printout.
Range("A1:M44").Printout
Next

---
Regards,
Tom Ogilvy

"mac" wrote:

Hi Dave,
Thank you for your help. I really appreciated it. I am not sure I
explained
it. My list is on the same sheet it goes from Q3:q431. I would like
to have
it lookup for first row(q3) paste it into d1 and then print it. Then
go to
the next row Q4 and do the same up to row 431. Is this possible to do?
Again thank you for taking to time to help.

--
thank you mac


"Dave Ramage" wrote:

mac,

This should work for you. Make sure the worksheet in question is
active
before you run it, and change the cell reference "A1" to the
appropriate
value.

Sub Cycle_ValidationValues()
Dim rngTarget As Range, rngList As Range, rngR As Range
Dim strList As String, strInitialValue As String

'set reference to target cell
Set rngTarget = Sheets("Sheet1").Range("A1") 'or whatever
'remeber initial value
strInitialValue = rngTarget.Value
'get the source list range
strList = rngTarget.Validation.Formula1
'remove the "=" from the start
strList = Right(strList, Len(strList) - 1)
'set reference to this list range
Set rngList = Range(strList)

'loop through each cell in list range
For Each rngR In rngList.Cells
rngTarget.Value = rngR.Value
ActiveSheet.PrintOut 'print with default settings
Next rngR

'reset initial value
rngTarget.Value = strInitialValue
End Sub

Cheers,
Dave,

"mac" wrote:

Hi,
I have a excel file that I set up with data validation. When I
select the
list the data changes. Can anyone help me set up a macro to select
each item
on list and then print it? Any help will be greatly appreciated.
--
thank you mac







--

Dave Peterson

Reply
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
custom data validation on cells with data validation values AKrobbins Excel Worksheet Functions 2 June 21st 11 04:20 PM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Programming 0 November 7th 06 12:54 PM
Data validation with validation lists and combo boxs Keith Excel Discussion (Misc queries) 1 October 12th 06 11:08 AM


All times are GMT +1. The time now is 03:10 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"