Insert values into multiple cells

Pinkster69

New Member
Joined
Jun 19, 2012
Messages
48
Hi Guys,
Hope you can help me out with a problem I am having, still fairly new to VBA!

I have a User form with a ComboBox "SKUNumberComboBox" which has a list of SKU Numbers and I have a Date Picker "DTPicker1" were I can pick a date and I also have a TextBox "ExtraDaysTextBox" were I enter the amount of Days.
Basicly when I enter the SKU Number in the "SKUNumberComboBox" and the Date from the "DTPicker1" and I enter a Value of lets say "8" in the "ExtraDaysTextBox" I have code finding the Cell that intersects between the Value in the SKUNumberComboBox" and the "DTPicker1" and from this cell I need to enter the number "1" in the "8" Cells on that row after that with respect to the value in the "ExtraDaysTextBox" which is "8".
I attached the code I have so far so I hope you can help me??

Code:
Const DataSheet = "Data"        ' Sheet with data
Const HatDates = "F2:AWG2"      ' Address of dates
Const HatSKUs = "A2:A1000"       ' Address of SKUs
Const FLAG = 1                  ' flag

Private Sub SetFlag()    ' Set flag in table, enters the number "1" in the appropriate cell
    
    On Local Error GoTo errors
    
    'Looks for the Cell with referance to the SKU and the Date and enters "1"
    With Sheets(DataSheet)
        Set DateFound = .Range(HatDates).Find(what:=DTPicker1.Value)
        Set SKUFound = .Range(HatSKUs).Find(what:=SKUNumberComboBox.Value)
                
        .Cells(SKUFound.Row, DateFound.Column) = FLAG           'Enters "1" in the Cell corrosponding to DTPicker1.Value & SKUNumberComboBox.Value
        
       
             
    End With
Exit Sub


errors:
    MsgBox "Error: " & Err.Description


End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Im So Sorry,
Im not making excuses but I am truly new to Forums and did not understand what I have done and the reasons why not to post on multiple forums until I read your link.
It will not happen again!

Just to let you know I posted on 3 other forums too, I will delete them immediatly

Thanks for the wake up call
 
Upvote 0
Hi VoG,

Sorry to ask, as I said I am new to this but does this mean that no one will ever answer any of my questions anymore?
 
Upvote 0
No it doesn't mean that. Some forums are very strict about cross posting and will lock or delete cross posted threads. We are more tolerant but we do ask that you provide links to where you have asked the same question.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,482
Members
452,916
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top