Skip Cells

mef1sto

Board Regular
Joined
Oct 31, 2013
Messages
85
Hi guys and a Happy New Year!
Please give me a helping hand in this matter:

Code:
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A7")) Is Nothing Then
    Dim lastc As String, j, firstc As String, sstep
    Dim i As Long, s As Long, e As Long
    firstc = InputBox("Fill in the first cell ex. A7")
    If Len(firstc) = 0 Then Exit Sub
        j = InputBox("First cell value, ex. 1 sau 3 etc.")
        lastc = InputBox("Last cell in asc order, ex. A10")
    If Len(lastc) = 0 Then Exit Sub
        sstep = InputBox("Value to increment cells ex. 1 sau 2 sau 3 sau cum doriti")
    Dim index As Integer
' ?? HERE I NEED ANOTHER OPTION TO SKIP UPON 1 OR MORE CELL AND ADD THE +1 INCREMENT OF THE VALUE 
    If Len(sstep) = 0 Then Exit Sub
        For i = 1 To e Step -1
        Range(firstc) = j '
        Range(firstc + i, lastc + i).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=sstep, Trend:=False
        Next i
End If
End Sub
I would attach the .xlsm file but i donno how :(

Thanks for your aid! ;)
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
both actually...first horizontally and after 5 iterations, with the help of a offset another round of 5 horizontally. i need them on parallel columns from A to G to M and so on..so they're practically horizontal way (on these columns i've mentioned).
 
Upvote 0
Instead of making us try and decipher your data layout and what non-working code should be doing, I think it would help if you described in words the layout of your data and what you hope the event code you posted will do for you.
 
Upvote 0
Ok guys, i'm more annoyed then you, believe me, I'm sorry. So when i click cell a7 i have several questions to fill in data in that cell, but my code will only fill in cells one after another from a starting cell till a designated last cell, i'm looking to fill after a pattern like so: fill cell a7 with a date (e.g. 06/01/2014) and then fill in the next cells increasing that date in this order: on the first column A, the next cell to be filled with 07/01/2014 is A11, then A15 (with 08/01/2014), then A19 (09/01/2014), then A23(10/01/2014), afterwards moving next to column G likewise (e.g. G7( with the parallel set of cell continuing counting dates ), G11, GG15, G19, G23) and so on (column M and column S). So they are only some cells which need to be filled increasingly starting with cell A7. Now i hope this explaining will help me better. Thank you!
 
Last edited:
Upvote 0
Ok guys, i'm more annoyed then you, believe me, I'm sorry. So when i click cell a7 i have several questions to fill in data in that cell, but my code will only fill in cells one after another from a starting cell till a designated last cell, i'm looking to fill after a pattern like so: fill cell a7 with a date (e.g. 06/01/2014) and then fill in the next cells increasing that date in this order: on the first column A, the next cell to be filled with 07/01/2014 is A11, then A15 (with 08/01/2014), then A19 (09/01/2014), then A23(10/01/2014), afterwards moving next to column G likewise (e.g. G7( with the parallel set of cell continuing counting dates ), G11, GG15, G19, G23) and so on (column M and column S). So they are only some cells which need to be filled increasingly starting with cell A7. Now i hope this explaining will help me better. Thank you!

We are not annoyed, it is just we did not know how to begin to help you based on what you told us initially.

Let me see if I understand (part of) what you want... the user fills in a date in A7 and the code automatically increments that date by one month into cells A11, A15, A19 and A23 (the process stops at A23, correct?). If this is correct, then explain the part highlighted in red... does the user enter a date into G7 or does the code fill it in from the date in cell A23? If so, what is the progression from A23 to G7... add one month? Whatever your answer to the foregoing, Column S is the last column to process dates in, correct?
 
Upvote 0
That is perfectly correct, i'm glad i made myself understood, the only exception is that the code doesn't increment by one month, but only by 1 day actually, so it starts counting from the first cell (A7 that is e.g. 01/06/2014) and stops at S23 (with 20/01/2014, so they're about 3 weeks), only they are on different columns, just 5 on each column. It's about the automation of this process, like a calendar with these dates, but i don't want to fill all of this data manually. Thank you so much!
P.S. i am annoyed for not succeeding in doing this to work, nothing to do with you guys, i appreciate all the help and support, believe me!
 
Last edited:
Upvote 0
That is perfectly correct, i'm glad i made myself understood, the only exception is that the code doesn't increment by one month, but only by 1 day actually, so it starts counting from the first cell (A7 that is e.g. 01/06/2014) and stops at S23 (with 20/01/2014, so they're about 3 weeks), only they are on different columns, just 5 on each column. It's about the automation of this process, like a calendar with these dates, but i don't want to fill all of this data manually.
For future questions you may ask, try and use example dates where the day number is greater than 12 so that we can see what date format you are using (m/d/y or d/m/y). Now, see if this change event code does what you want (it is not a macro, it is event code like you posted originally, but the Change event, not the SelectionChange event)...

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim R As Long, C As Long, Index As Long
  If Target.Address(0, 0) = "A7" Then
    If IsDate(Target.Value) Then
      For C = 1 To 19 Step 6
        For R = 7 To 23 Step 4
          Cells(R, C).Value = Target.Value + Index
          Index = Index + 1
        Next
      Next
    End If
  End If
End Sub
 
Upvote 0
You're right i'm terribly sorry, forgot i was on a different part of the world so different dates, so sorry, my mistake. On the second hand, not sure i know how to make this work, since i don't see it do anything. My bad i guess :(
 
Upvote 0

Forum statistics

Threads
1,223,272
Messages
6,171,113
Members
452,381
Latest member
Nova88

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