ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation list problem (https://www.excelbanter.com/excel-programming/420533-validation-list-problem.html)

Greg Snidow

Validation list problem
 
Greetings all. I have a workbook with a sheet for each month of the year,
and a blank template at the end to add new months. In some of the columns,
the cells are populated by using a pick list which I created using
DataValidation, and typing the values way below the records. No problems
here. The problem is that if I have to cut and insert a row from one sheet
to the next, the list references in the cut row are off. I tried creating a
sheet called 'Data', and make the list reference 'Data!$A2:A...', but the
error says that I must use a list on the same page. Is there a way for me to
reference a list on another sheet? Or, how could I use VB to programatically
set the list to the range of the list on the new sheet?

Greg Snidow

Validation list problem
 
Well, I was in a pinch, so I solved my problem by inserting code in the macro
to move the lists back to their original position after every insert. I
would still like to know how to programatically set the list reference.
Thanks

Sub MoveLists()

Dim TopRow As String
Dim LstRow As String

LstRow = [F65000].End(xlUp).Row
Range("F" & LstRow).Activate
Do While ActiveCell.Value < ""
If ActiveCell.Value < "" Then
ActiveCell.Offset(-1, 0).Activate
End If
Loop

TopRow = ActiveCell.Offset(1, 0).Row

Rows(TopRow & ":" & LstRow).Cut
Rows("200").Select
Selection.Insert shift:=xlDown

End Sub

"Greg Snidow" wrote:

Greetings all. I have a workbook with a sheet for each month of the year,
and a blank template at the end to add new months. In some of the columns,
the cells are populated by using a pick list which I created using
DataValidation, and typing the values way below the records. No problems
here. The problem is that if I have to cut and insert a row from one sheet
to the next, the list references in the cut row are off. I tried creating a
sheet called 'Data', and make the list reference 'Data!$A2:A...', but the
error says that I must use a list on the same page. Is there a way for me to
reference a list on another sheet? Or, how could I use VB to programatically
set the list to the range of the list on the new sheet?


Greg Snidow

Validation list problem
 
Well, that plan did not work out so well. I found that regardless of whether
or not the lists are at the same row on each sheet, when I cut the row and
insert it into a new sheet, the reference in Datavalidatation source box is
gone. Is there a way to make it stay. The list for the first box is at
F200. Is there a programatic way I can put in the macro to set the source
for the list? I am at my wits end with this. Thank you.

"Greg Snidow" wrote:

Well, I was in a pinch, so I solved my problem by inserting code in the macro
to move the lists back to their original position after every insert. I
would still like to know how to programatically set the list reference.
Thanks

Sub MoveLists()

Dim TopRow As String
Dim LstRow As String

LstRow = [F65000].End(xlUp).Row
Range("F" & LstRow).Activate
Do While ActiveCell.Value < ""
If ActiveCell.Value < "" Then
ActiveCell.Offset(-1, 0).Activate
End If
Loop

TopRow = ActiveCell.Offset(1, 0).Row

Rows(TopRow & ":" & LstRow).Cut
Rows("200").Select
Selection.Insert shift:=xlDown

End Sub

"Greg Snidow" wrote:

Greetings all. I have a workbook with a sheet for each month of the year,
and a blank template at the end to add new months. In some of the columns,
the cells are populated by using a pick list which I created using
DataValidation, and typing the values way below the records. No problems
here. The problem is that if I have to cut and insert a row from one sheet
to the next, the list references in the cut row are off. I tried creating a
sheet called 'Data', and make the list reference 'Data!$A2:A...', but the
error says that I must use a list on the same page. Is there a way for me to
reference a list on another sheet? Or, how could I use VB to programatically
set the list to the range of the list on the new sheet?


Debra Dalgleish

Validation list problem
 
You can refer to a list on a different sheet if you name the range that
contains the list. There are instructions he

http://www.contextures.com/xlDataVal01.html

Greg Snidow wrote:
Well, that plan did not work out so well. I found that regardless of whether
or not the lists are at the same row on each sheet, when I cut the row and
insert it into a new sheet, the reference in Datavalidatation source box is
gone. Is there a way to make it stay. The list for the first box is at
F200. Is there a programatic way I can put in the macro to set the source
for the list? I am at my wits end with this. Thank you.

"Greg Snidow" wrote:


Well, I was in a pinch, so I solved my problem by inserting code in the macro
to move the lists back to their original position after every insert. I
would still like to know how to programatically set the list reference.
Thanks

Sub MoveLists()

Dim TopRow As String
Dim LstRow As String

LstRow = [F65000].End(xlUp).Row
Range("F" & LstRow).Activate
Do While ActiveCell.Value < ""
If ActiveCell.Value < "" Then
ActiveCell.Offset(-1, 0).Activate
End If
Loop

TopRow = ActiveCell.Offset(1, 0).Row

Rows(TopRow & ":" & LstRow).Cut
Rows("200").Select
Selection.Insert shift:=xlDown

End Sub

"Greg Snidow" wrote:


Greetings all. I have a workbook with a sheet for each month of the year,
and a blank template at the end to add new months. In some of the columns,
the cells are populated by using a pick list which I created using
DataValidation, and typing the values way below the records. No problems
here. The problem is that if I have to cut and insert a row from one sheet
to the next, the list references in the cut row are off. I tried creating a
sheet called 'Data', and make the list reference 'Data!$A2:A...', but the
error says that I must use a list on the same page. Is there a way for me to
reference a list on another sheet? Or, how could I use VB to programatically
set the list to the range of the list on the new sheet?




--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com



All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com