luissuarez
New Member
- Joined
- Mar 17, 2016
- Messages
- 4
Code:
Sub Insertacts()
Dim sheetsch As Worksheet
Set sheetsch = Sheet1
Dim sheeteat As Worksheet
Set sheeteat = Sheet2
colnum = Application.WorksheetFunction.Match(sheeteat.Range("F2"), sheetsch.Range("A1:G1"))
rownum = Application.WorksheetFunction.Match(sheeteat.Range("G2"), sheetsch.Range("A1:A25"))
sheeteat.Range("A2").Copy
sheetsch.Cells(rownum, colnum).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Schedule").Select
End Sub
Hello everyone! I am trying to create a timetable where activities can be added from another sheet. I wrote the above codes and it works smoothly except a few bugs.
The activity cannot be inserted into a correct row when I put the time of 13:00 or 16:00 in Range("G2") in Sheet2. It apprears on the row of 12:00 and 15:00 in Sheet1 respectively instead. Anyone knows why that is the case? Thanks a lot.
<a href=http://www.filedropper.com/timeschedule><img src=http://www.filedropper.com/download_button.png width=127 height=145 border=0/></a><br /><div style=font-size:9px;font-family:Arial, Helvetica, sans-serif;width:127px;font-color:#44a854;> <a href=http://www.filedropper.com >upload files online</a></div>