No announcement yet.

write to col. based on criteria (value in a cell)

  • Filter
  • Time
  • Show
Clear All
new posts

  • write to col. based on criteria (value in a cell)

    Hi guys & girls
    Had great response from last query which was to write to a specific column from a cell in the same row after evaluating a column of data ;-

    Sub copycell()
    '//// rows 7 to 150
    For i = 7 To 150
    '///// data starts row 7, and looks in column E
    For Each cell In ActiveSheet.Cells(7, 5)
    If ActiveSheet.Cells(i, 5).Value > 0 Then
    ThisWorkbook.Sheets("VolunteerDistance").Cells(i, 9).Value = ActiveSheet.Cells(i, 5).Value
    '//// sets Column I same row as the value we found in Column E
    End If
    End Sub
    Value of col.5 was written to col. 9 same row.
    This works well but limits 'write' to a single specified column.
    Now I want to be able to do the same thing but write to a colum based on 'value of another cell' - actually a value located using 'match'.
    Last edited by AlanSidman; May 25th, 2019, 06:49.

  • #2

    Code Tags Added
    Your post does not comply with our Forum RULES. Use code tags around code.

    Posting code between tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window.

    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

    Did you debug your code first?
    FORUM RULES----->

    If someone has helped you, say "thank you" by clicking on the Like Button.