Hello beautiful people
I am currently teaching myself VBA coding in Excel and have answered most of my questions with Google searches, it has been an interesting, fun but also draining project so far. That being said I am having problems with this last part of the database I am setting up.
SCENARIO
I have 2 sheets (Sheet1 Name = HOTO / Sheet2 Name = Latest) and what I want to do is copy the data entered into sheets("HOTO").range("A2:F9") and then search column "a" on sheets("latest") and find the value that is in "b2" on Sheets("HOTO") and then select the cell one column across and one cell up and paste the data. eg: it finds the value Monday in cell "B2" on sheets("HOTO"), it then searches for that value in column "a" on sheets("latest") and finds it on row"19". Having found the value in then pastes the copied data in cells "B18:G25".
Once the data is pasted it then returns to Sheets("HOTO") and clears the data ready for the next entry.
This is what I have so far:
>>> use code - tags <<<
As I said I have been teaching myself through research but I just can't find this last part.
Any help would be greatly appreciated.
Thanks in advance
Mathew Kelly (DadBod)
I am currently teaching myself VBA coding in Excel and have answered most of my questions with Google searches, it has been an interesting, fun but also draining project so far. That being said I am having problems with this last part of the database I am setting up.
SCENARIO
I have 2 sheets (Sheet1 Name = HOTO / Sheet2 Name = Latest) and what I want to do is copy the data entered into sheets("HOTO").range("A2:F9") and then search column "a" on sheets("latest") and find the value that is in "b2" on Sheets("HOTO") and then select the cell one column across and one cell up and paste the data. eg: it finds the value Monday in cell "B2" on sheets("HOTO"), it then searches for that value in column "a" on sheets("latest") and finds it on row"19". Having found the value in then pastes the copied data in cells "B18:G25".
Once the data is pasted it then returns to Sheets("HOTO") and clears the data ready for the next entry.
This is what I have so far:
>>> use code - tags <<<
Code:
Private sub HOTO_click()
sheets("hoto").select
sheets("hoto").range("a2:f9").copy
'this is the code I am missing'
selection.pastespecial paste:=pastevalues
sheets("HOTO").select
activesheet.range("a2").clearcontents
activesheet.range("b2").clearcontents
activesheet.range("c2:c9").clearcontents (merged cells)
activesheet.range("d2:d9").clearcontents (merged cells)
activesheet.range("e2:e9").clearcontents (merged cells)
activesheet.range("f2:f9").clearcontents (separate cells)
End Sub
As I said I have been teaching myself through research but I just can't find this last part.
Any help would be greatly appreciated.
Thanks in advance
Mathew Kelly (DadBod)
Last edited by a moderator: