Excel VBA: saving partial data creates new row each time. How to update if row has values












0















I have a simple form that allows to enter counts at different times of the day.



My form loads the values of the last row in the table to the UserForm so that whoever opens the form to enter the next count gets the previous values placed in the form:



Private Sub UserForm_Initialize()
Dim lr As Long
lr = ActiveSheet.Range("A1").End(xlDown).Row
eightWkd.Value = Cells(lr, 3)
nineWkd.Value = Cells(lr, 4)
ten30Wkd.Value = Cells(lr, 6)
noonWkd.Value = Cells(lr, 8)
one30Wkd.Value = Cells(lr, 10)
threeWkd.Value = Cells(lr, 12)
four30Wkd.Value = Cells(lr, 14)
sixWkd.Value = Cells(lr, 15)


But, each submission creates a new row.
screenshot of excel sheet



Here is my code for my submit button, setting the values. Changing the loaded values works. I find the first empty row



Private Sub SubmitButton_Click()
Dim ws As Worksheet
Set ws = Worksheets("daily_count")
Dim lr As Long, varDay As Long
With ws
lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
.Cells(lr, 1).Value = Me.DateWkd.Value
.Cells(lr, 2).Value = Me.DayWkd.Value
.Cells(lr, 3).Value = Me.eightWkd.Value
.Cells(lr, 4).Value = Me.nineWkd.Value
.Cells(lr, 6).Value = Me.ten30Wkd.Value
.Cells(lr, 8).Value = Me.noonWkd.Value
.Cells(lr, 10).Value = Me.one30Wkd.Value
.Cells(lr, 12).Value = Me.threeWkd.Value
.Cells(lr, 14).Value = Me.four30Wkd.Value
.Cells(lr, 15).Value = Me.sixWkd.Value


I tried the following logic, to choose between the last existing row, and a new row, based on whether the date value (column A) is set, but it didn't work.



If ActiveSheet.Range("A1") = Format(Date, "mm/dd/yy") Then
r = ActiveSheet.Range("A1").End(xlDown).Row
Else
r = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
End If


So, how do I update cells in the row instead of creating a new row?










share|improve this question



























    0















    I have a simple form that allows to enter counts at different times of the day.



    My form loads the values of the last row in the table to the UserForm so that whoever opens the form to enter the next count gets the previous values placed in the form:



    Private Sub UserForm_Initialize()
    Dim lr As Long
    lr = ActiveSheet.Range("A1").End(xlDown).Row
    eightWkd.Value = Cells(lr, 3)
    nineWkd.Value = Cells(lr, 4)
    ten30Wkd.Value = Cells(lr, 6)
    noonWkd.Value = Cells(lr, 8)
    one30Wkd.Value = Cells(lr, 10)
    threeWkd.Value = Cells(lr, 12)
    four30Wkd.Value = Cells(lr, 14)
    sixWkd.Value = Cells(lr, 15)


    But, each submission creates a new row.
    screenshot of excel sheet



    Here is my code for my submit button, setting the values. Changing the loaded values works. I find the first empty row



    Private Sub SubmitButton_Click()
    Dim ws As Worksheet
    Set ws = Worksheets("daily_count")
    Dim lr As Long, varDay As Long
    With ws
    lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
    .Cells(lr, 1).Value = Me.DateWkd.Value
    .Cells(lr, 2).Value = Me.DayWkd.Value
    .Cells(lr, 3).Value = Me.eightWkd.Value
    .Cells(lr, 4).Value = Me.nineWkd.Value
    .Cells(lr, 6).Value = Me.ten30Wkd.Value
    .Cells(lr, 8).Value = Me.noonWkd.Value
    .Cells(lr, 10).Value = Me.one30Wkd.Value
    .Cells(lr, 12).Value = Me.threeWkd.Value
    .Cells(lr, 14).Value = Me.four30Wkd.Value
    .Cells(lr, 15).Value = Me.sixWkd.Value


    I tried the following logic, to choose between the last existing row, and a new row, based on whether the date value (column A) is set, but it didn't work.



    If ActiveSheet.Range("A1") = Format(Date, "mm/dd/yy") Then
    r = ActiveSheet.Range("A1").End(xlDown).Row
    Else
    r = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
    End If


    So, how do I update cells in the row instead of creating a new row?










    share|improve this question

























      0












      0








      0








      I have a simple form that allows to enter counts at different times of the day.



      My form loads the values of the last row in the table to the UserForm so that whoever opens the form to enter the next count gets the previous values placed in the form:



      Private Sub UserForm_Initialize()
      Dim lr As Long
      lr = ActiveSheet.Range("A1").End(xlDown).Row
      eightWkd.Value = Cells(lr, 3)
      nineWkd.Value = Cells(lr, 4)
      ten30Wkd.Value = Cells(lr, 6)
      noonWkd.Value = Cells(lr, 8)
      one30Wkd.Value = Cells(lr, 10)
      threeWkd.Value = Cells(lr, 12)
      four30Wkd.Value = Cells(lr, 14)
      sixWkd.Value = Cells(lr, 15)


      But, each submission creates a new row.
      screenshot of excel sheet



      Here is my code for my submit button, setting the values. Changing the loaded values works. I find the first empty row



      Private Sub SubmitButton_Click()
      Dim ws As Worksheet
      Set ws = Worksheets("daily_count")
      Dim lr As Long, varDay As Long
      With ws
      lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
      .Cells(lr, 1).Value = Me.DateWkd.Value
      .Cells(lr, 2).Value = Me.DayWkd.Value
      .Cells(lr, 3).Value = Me.eightWkd.Value
      .Cells(lr, 4).Value = Me.nineWkd.Value
      .Cells(lr, 6).Value = Me.ten30Wkd.Value
      .Cells(lr, 8).Value = Me.noonWkd.Value
      .Cells(lr, 10).Value = Me.one30Wkd.Value
      .Cells(lr, 12).Value = Me.threeWkd.Value
      .Cells(lr, 14).Value = Me.four30Wkd.Value
      .Cells(lr, 15).Value = Me.sixWkd.Value


      I tried the following logic, to choose between the last existing row, and a new row, based on whether the date value (column A) is set, but it didn't work.



      If ActiveSheet.Range("A1") = Format(Date, "mm/dd/yy") Then
      r = ActiveSheet.Range("A1").End(xlDown).Row
      Else
      r = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
      End If


      So, how do I update cells in the row instead of creating a new row?










      share|improve this question














      I have a simple form that allows to enter counts at different times of the day.



      My form loads the values of the last row in the table to the UserForm so that whoever opens the form to enter the next count gets the previous values placed in the form:



      Private Sub UserForm_Initialize()
      Dim lr As Long
      lr = ActiveSheet.Range("A1").End(xlDown).Row
      eightWkd.Value = Cells(lr, 3)
      nineWkd.Value = Cells(lr, 4)
      ten30Wkd.Value = Cells(lr, 6)
      noonWkd.Value = Cells(lr, 8)
      one30Wkd.Value = Cells(lr, 10)
      threeWkd.Value = Cells(lr, 12)
      four30Wkd.Value = Cells(lr, 14)
      sixWkd.Value = Cells(lr, 15)


      But, each submission creates a new row.
      screenshot of excel sheet



      Here is my code for my submit button, setting the values. Changing the loaded values works. I find the first empty row



      Private Sub SubmitButton_Click()
      Dim ws As Worksheet
      Set ws = Worksheets("daily_count")
      Dim lr As Long, varDay As Long
      With ws
      lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
      .Cells(lr, 1).Value = Me.DateWkd.Value
      .Cells(lr, 2).Value = Me.DayWkd.Value
      .Cells(lr, 3).Value = Me.eightWkd.Value
      .Cells(lr, 4).Value = Me.nineWkd.Value
      .Cells(lr, 6).Value = Me.ten30Wkd.Value
      .Cells(lr, 8).Value = Me.noonWkd.Value
      .Cells(lr, 10).Value = Me.one30Wkd.Value
      .Cells(lr, 12).Value = Me.threeWkd.Value
      .Cells(lr, 14).Value = Me.four30Wkd.Value
      .Cells(lr, 15).Value = Me.sixWkd.Value


      I tried the following logic, to choose between the last existing row, and a new row, based on whether the date value (column A) is set, but it didn't work.



      If ActiveSheet.Range("A1") = Format(Date, "mm/dd/yy") Then
      r = ActiveSheet.Range("A1").End(xlDown).Row
      Else
      r = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
      End If


      So, how do I update cells in the row instead of creating a new row?







      excel vba excel-vba userform






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 '18 at 16:37









      mattrweavermattrweaver

      306622




      306622
























          1 Answer
          1






          active

          oldest

          votes


















          0














          How about using the .Find method to find the row with the current date and then update the values of that row if found, and if not found then add the values to the next free row:



          Private Sub SubmitButton_Click()
          Dim ws As Worksheet
          Set ws = Worksheets("daily_count")
          Dim lr As Long, varDay As Long, rng as Range
          FindVal = Format(Date, "mm/dd/yy")
          Set Rng = ws.Range("A:A").Find(What:=FindVal, lookat:=xlWhole)
          If Not Rng Is Nothing Then
          With ws
          .Cells(Rng.Row, 1).Value = Me.DateWkd.Value
          .Cells(Rng.Row, 2).Value = Me.DayWkd.Value
          .Cells(Rng.Row, 3).Value = .Cells(Rng.Row, 3).Value + Me.eightWkd.Value
          .Cells(Rng.Row, 4).Value = .Cells(Rng.Row, 4).Value + Me.nineWkd.Value
          .Cells(Rng.Row, 6).Value = .Cells(Rng.Row, 6).Value + Me.ten30Wkd.Value
          .Cells(Rng.Row, 8).Value = .Cells(Rng.Row, 8).Value + Me.noonWkd.Value
          .Cells(Rng.Row, 10).Value = .Cells(Rng.Row, 10).Value + Me.one30Wkd.Value
          .Cells(Rng.Row, 12).Value = .Cells(Rng.Row, 12).Value + Me.threeWkd.Value
          .Cells(Rng.Row, 14).Value = .Cells(Rng.Row, 14).Value + Me.four30Wkd.Value
          .Cells(Rng.Row, 15).Value = .Cells(Rng.Row, 15).Value + Me.sixWkd.Value
          End With
          Else
          With ws
          lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
          .Cells(lr, 1).Value = Me.DateWkd.Value
          .Cells(lr, 2).Value = Me.DayWkd.Value
          .Cells(lr, 3).Value = Me.eightWkd.Value
          .Cells(lr, 4).Value = Me.nineWkd.Value
          .Cells(lr, 6).Value = Me.ten30Wkd.Value
          .Cells(lr, 8).Value = Me.noonWkd.Value
          .Cells(lr, 10).Value = Me.one30Wkd.Value
          .Cells(lr, 12).Value = Me.threeWkd.Value
          .Cells(lr, 14).Value = Me.four30Wkd.Value
          .Cells(lr, 15).Value = Me.sixWkd.Value
          End With
          End If
          End Sub





          share|improve this answer


























          • Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

            – mattrweaver
            Nov 12 '18 at 19:44











          • Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

            – mattrweaver
            Nov 12 '18 at 19:56











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266465%2fexcel-vba-saving-partial-data-creates-new-row-each-time-how-to-update-if-row-h%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          How about using the .Find method to find the row with the current date and then update the values of that row if found, and if not found then add the values to the next free row:



          Private Sub SubmitButton_Click()
          Dim ws As Worksheet
          Set ws = Worksheets("daily_count")
          Dim lr As Long, varDay As Long, rng as Range
          FindVal = Format(Date, "mm/dd/yy")
          Set Rng = ws.Range("A:A").Find(What:=FindVal, lookat:=xlWhole)
          If Not Rng Is Nothing Then
          With ws
          .Cells(Rng.Row, 1).Value = Me.DateWkd.Value
          .Cells(Rng.Row, 2).Value = Me.DayWkd.Value
          .Cells(Rng.Row, 3).Value = .Cells(Rng.Row, 3).Value + Me.eightWkd.Value
          .Cells(Rng.Row, 4).Value = .Cells(Rng.Row, 4).Value + Me.nineWkd.Value
          .Cells(Rng.Row, 6).Value = .Cells(Rng.Row, 6).Value + Me.ten30Wkd.Value
          .Cells(Rng.Row, 8).Value = .Cells(Rng.Row, 8).Value + Me.noonWkd.Value
          .Cells(Rng.Row, 10).Value = .Cells(Rng.Row, 10).Value + Me.one30Wkd.Value
          .Cells(Rng.Row, 12).Value = .Cells(Rng.Row, 12).Value + Me.threeWkd.Value
          .Cells(Rng.Row, 14).Value = .Cells(Rng.Row, 14).Value + Me.four30Wkd.Value
          .Cells(Rng.Row, 15).Value = .Cells(Rng.Row, 15).Value + Me.sixWkd.Value
          End With
          Else
          With ws
          lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
          .Cells(lr, 1).Value = Me.DateWkd.Value
          .Cells(lr, 2).Value = Me.DayWkd.Value
          .Cells(lr, 3).Value = Me.eightWkd.Value
          .Cells(lr, 4).Value = Me.nineWkd.Value
          .Cells(lr, 6).Value = Me.ten30Wkd.Value
          .Cells(lr, 8).Value = Me.noonWkd.Value
          .Cells(lr, 10).Value = Me.one30Wkd.Value
          .Cells(lr, 12).Value = Me.threeWkd.Value
          .Cells(lr, 14).Value = Me.four30Wkd.Value
          .Cells(lr, 15).Value = Me.sixWkd.Value
          End With
          End If
          End Sub





          share|improve this answer


























          • Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

            – mattrweaver
            Nov 12 '18 at 19:44











          • Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

            – mattrweaver
            Nov 12 '18 at 19:56
















          0














          How about using the .Find method to find the row with the current date and then update the values of that row if found, and if not found then add the values to the next free row:



          Private Sub SubmitButton_Click()
          Dim ws As Worksheet
          Set ws = Worksheets("daily_count")
          Dim lr As Long, varDay As Long, rng as Range
          FindVal = Format(Date, "mm/dd/yy")
          Set Rng = ws.Range("A:A").Find(What:=FindVal, lookat:=xlWhole)
          If Not Rng Is Nothing Then
          With ws
          .Cells(Rng.Row, 1).Value = Me.DateWkd.Value
          .Cells(Rng.Row, 2).Value = Me.DayWkd.Value
          .Cells(Rng.Row, 3).Value = .Cells(Rng.Row, 3).Value + Me.eightWkd.Value
          .Cells(Rng.Row, 4).Value = .Cells(Rng.Row, 4).Value + Me.nineWkd.Value
          .Cells(Rng.Row, 6).Value = .Cells(Rng.Row, 6).Value + Me.ten30Wkd.Value
          .Cells(Rng.Row, 8).Value = .Cells(Rng.Row, 8).Value + Me.noonWkd.Value
          .Cells(Rng.Row, 10).Value = .Cells(Rng.Row, 10).Value + Me.one30Wkd.Value
          .Cells(Rng.Row, 12).Value = .Cells(Rng.Row, 12).Value + Me.threeWkd.Value
          .Cells(Rng.Row, 14).Value = .Cells(Rng.Row, 14).Value + Me.four30Wkd.Value
          .Cells(Rng.Row, 15).Value = .Cells(Rng.Row, 15).Value + Me.sixWkd.Value
          End With
          Else
          With ws
          lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
          .Cells(lr, 1).Value = Me.DateWkd.Value
          .Cells(lr, 2).Value = Me.DayWkd.Value
          .Cells(lr, 3).Value = Me.eightWkd.Value
          .Cells(lr, 4).Value = Me.nineWkd.Value
          .Cells(lr, 6).Value = Me.ten30Wkd.Value
          .Cells(lr, 8).Value = Me.noonWkd.Value
          .Cells(lr, 10).Value = Me.one30Wkd.Value
          .Cells(lr, 12).Value = Me.threeWkd.Value
          .Cells(lr, 14).Value = Me.four30Wkd.Value
          .Cells(lr, 15).Value = Me.sixWkd.Value
          End With
          End If
          End Sub





          share|improve this answer


























          • Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

            – mattrweaver
            Nov 12 '18 at 19:44











          • Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

            – mattrweaver
            Nov 12 '18 at 19:56














          0












          0








          0







          How about using the .Find method to find the row with the current date and then update the values of that row if found, and if not found then add the values to the next free row:



          Private Sub SubmitButton_Click()
          Dim ws As Worksheet
          Set ws = Worksheets("daily_count")
          Dim lr As Long, varDay As Long, rng as Range
          FindVal = Format(Date, "mm/dd/yy")
          Set Rng = ws.Range("A:A").Find(What:=FindVal, lookat:=xlWhole)
          If Not Rng Is Nothing Then
          With ws
          .Cells(Rng.Row, 1).Value = Me.DateWkd.Value
          .Cells(Rng.Row, 2).Value = Me.DayWkd.Value
          .Cells(Rng.Row, 3).Value = .Cells(Rng.Row, 3).Value + Me.eightWkd.Value
          .Cells(Rng.Row, 4).Value = .Cells(Rng.Row, 4).Value + Me.nineWkd.Value
          .Cells(Rng.Row, 6).Value = .Cells(Rng.Row, 6).Value + Me.ten30Wkd.Value
          .Cells(Rng.Row, 8).Value = .Cells(Rng.Row, 8).Value + Me.noonWkd.Value
          .Cells(Rng.Row, 10).Value = .Cells(Rng.Row, 10).Value + Me.one30Wkd.Value
          .Cells(Rng.Row, 12).Value = .Cells(Rng.Row, 12).Value + Me.threeWkd.Value
          .Cells(Rng.Row, 14).Value = .Cells(Rng.Row, 14).Value + Me.four30Wkd.Value
          .Cells(Rng.Row, 15).Value = .Cells(Rng.Row, 15).Value + Me.sixWkd.Value
          End With
          Else
          With ws
          lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
          .Cells(lr, 1).Value = Me.DateWkd.Value
          .Cells(lr, 2).Value = Me.DayWkd.Value
          .Cells(lr, 3).Value = Me.eightWkd.Value
          .Cells(lr, 4).Value = Me.nineWkd.Value
          .Cells(lr, 6).Value = Me.ten30Wkd.Value
          .Cells(lr, 8).Value = Me.noonWkd.Value
          .Cells(lr, 10).Value = Me.one30Wkd.Value
          .Cells(lr, 12).Value = Me.threeWkd.Value
          .Cells(lr, 14).Value = Me.four30Wkd.Value
          .Cells(lr, 15).Value = Me.sixWkd.Value
          End With
          End If
          End Sub





          share|improve this answer















          How about using the .Find method to find the row with the current date and then update the values of that row if found, and if not found then add the values to the next free row:



          Private Sub SubmitButton_Click()
          Dim ws As Worksheet
          Set ws = Worksheets("daily_count")
          Dim lr As Long, varDay As Long, rng as Range
          FindVal = Format(Date, "mm/dd/yy")
          Set Rng = ws.Range("A:A").Find(What:=FindVal, lookat:=xlWhole)
          If Not Rng Is Nothing Then
          With ws
          .Cells(Rng.Row, 1).Value = Me.DateWkd.Value
          .Cells(Rng.Row, 2).Value = Me.DayWkd.Value
          .Cells(Rng.Row, 3).Value = .Cells(Rng.Row, 3).Value + Me.eightWkd.Value
          .Cells(Rng.Row, 4).Value = .Cells(Rng.Row, 4).Value + Me.nineWkd.Value
          .Cells(Rng.Row, 6).Value = .Cells(Rng.Row, 6).Value + Me.ten30Wkd.Value
          .Cells(Rng.Row, 8).Value = .Cells(Rng.Row, 8).Value + Me.noonWkd.Value
          .Cells(Rng.Row, 10).Value = .Cells(Rng.Row, 10).Value + Me.one30Wkd.Value
          .Cells(Rng.Row, 12).Value = .Cells(Rng.Row, 12).Value + Me.threeWkd.Value
          .Cells(Rng.Row, 14).Value = .Cells(Rng.Row, 14).Value + Me.four30Wkd.Value
          .Cells(Rng.Row, 15).Value = .Cells(Rng.Row, 15).Value + Me.sixWkd.Value
          End With
          Else
          With ws
          lr = .Cells(.Rows.Count, varDay).End(xlUp).Offset(1, 0).Row
          .Cells(lr, 1).Value = Me.DateWkd.Value
          .Cells(lr, 2).Value = Me.DayWkd.Value
          .Cells(lr, 3).Value = Me.eightWkd.Value
          .Cells(lr, 4).Value = Me.nineWkd.Value
          .Cells(lr, 6).Value = Me.ten30Wkd.Value
          .Cells(lr, 8).Value = Me.noonWkd.Value
          .Cells(lr, 10).Value = Me.one30Wkd.Value
          .Cells(lr, 12).Value = Me.threeWkd.Value
          .Cells(lr, 14).Value = Me.four30Wkd.Value
          .Cells(lr, 15).Value = Me.sixWkd.Value
          End With
          End If
          End Sub






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 '18 at 8:52

























          answered Nov 12 '18 at 16:49









          XabierXabier

          6,5781418




          6,5781418













          • Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

            – mattrweaver
            Nov 12 '18 at 19:44











          • Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

            – mattrweaver
            Nov 12 '18 at 19:56



















          • Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

            – mattrweaver
            Nov 12 '18 at 19:44











          • Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

            – mattrweaver
            Nov 12 '18 at 19:56

















          Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

          – mattrweaver
          Nov 12 '18 at 19:44





          Thanks for your response but I'm seeing the same behavior. I changed the "find" to look for the day of the week, and I am getting a "type mismatch" error on ".Cells(rng.Row, 1).Value = .Cells(rng.Row, 1).Value + Me.DateWkd.Value"

          – mattrweaver
          Nov 12 '18 at 19:44













          Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

          – mattrweaver
          Nov 12 '18 at 19:56





          Ok, I got this to work. I stripped the second ".Cells(Rng.Row, #) +" out of the first group of lines which cleared the error. Thanks

          – mattrweaver
          Nov 12 '18 at 19:56


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266465%2fexcel-vba-saving-partial-data-creates-new-row-each-time-how-to-update-if-row-h%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown