Toonies
09-10-2011, 08:07 AM
Hi and thank you for looking at my post
I have the found the following VBA code and amended it, which works on 2 sheets, but it only puts the data 1 sheet at a time using 2 separate forms.
What I am trying to do is for the VBA to put the data on both sheets at the same time but only using 1 form.
I have tried to amend the VBA code but I am hitting a http://www.mrexcel.com/forum/images/smilies/icon_banghead.gif.
the two ranges "B6:B45" on both sheets have exactly the same list in the same order?
Private Sub UserForm_Initialize()
Dim Dys As Integer
Dim n As Integer
Dim Dt As Date
Dys = DateValue("1/1/" & Year(Now)) - DateValue("1/1/" & (Year(Now) - 1))
ReDim Ray(1 To Dys)
Dt = "1/1/" & Year(Now)
For n = 1 To Dys
Ray(n) = IIf(n = 1, Dt, DateAdd("d", 1, Dt))
Dt = Ray(n)
Next n
Me.ComboBox1.List = Application.Transpose(Ray)
Me.ComboBox2.List = Application.Transpose(Ray)
nameBox1.List = Worksheets("January-June").Range("B6:B45").Value
End Sub
Private Sub UserForm_Initialise()
Dim Dys As Integer
Dim n As Integer
Dim Dt As Date
Dys = DateValue("1/1/" & Year(Now)) - DateValue("1/1/" & (Year(Now) - 1))
ReDim Ray(1 To Dys)
Dt = "1/1/" & Year(Now)
For n = 1 To Dys
Ray(n) = IIf(n = 1, Dt, DateAdd("d", 1, Dt))
Dt = Ray(n)
Next n
Me.ComboBox1.List = Application.Transpose(Ray)
Me.ComboBox2.List = Application.Transpose(Ray)
nameBox1.List = Worksheets("July - December").Range("B6:B45").Value
End Sub
I have posted this question at
http://www.mrexcel.com/forum/showthread.php?t=577919
I did ask a similar question a few days earlier but this is more specific
the previous link is
http://www.vbaexpress.com/forum/showthread.php?t=38930
I look forward to any help or suggestions
Toonies
I have the found the following VBA code and amended it, which works on 2 sheets, but it only puts the data 1 sheet at a time using 2 separate forms.
What I am trying to do is for the VBA to put the data on both sheets at the same time but only using 1 form.
I have tried to amend the VBA code but I am hitting a http://www.mrexcel.com/forum/images/smilies/icon_banghead.gif.
the two ranges "B6:B45" on both sheets have exactly the same list in the same order?
Private Sub UserForm_Initialize()
Dim Dys As Integer
Dim n As Integer
Dim Dt As Date
Dys = DateValue("1/1/" & Year(Now)) - DateValue("1/1/" & (Year(Now) - 1))
ReDim Ray(1 To Dys)
Dt = "1/1/" & Year(Now)
For n = 1 To Dys
Ray(n) = IIf(n = 1, Dt, DateAdd("d", 1, Dt))
Dt = Ray(n)
Next n
Me.ComboBox1.List = Application.Transpose(Ray)
Me.ComboBox2.List = Application.Transpose(Ray)
nameBox1.List = Worksheets("January-June").Range("B6:B45").Value
End Sub
Private Sub UserForm_Initialise()
Dim Dys As Integer
Dim n As Integer
Dim Dt As Date
Dys = DateValue("1/1/" & Year(Now)) - DateValue("1/1/" & (Year(Now) - 1))
ReDim Ray(1 To Dys)
Dt = "1/1/" & Year(Now)
For n = 1 To Dys
Ray(n) = IIf(n = 1, Dt, DateAdd("d", 1, Dt))
Dt = Ray(n)
Next n
Me.ComboBox1.List = Application.Transpose(Ray)
Me.ComboBox2.List = Application.Transpose(Ray)
nameBox1.List = Worksheets("July - December").Range("B6:B45").Value
End Sub
I have posted this question at
http://www.mrexcel.com/forum/showthread.php?t=577919
I did ask a similar question a few days earlier but this is more specific
the previous link is
http://www.vbaexpress.com/forum/showthread.php?t=38930
I look forward to any help or suggestions
Toonies