Question about the criteria format in match function

Status
Not open for further replies.

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.

http://www.filedropper.com/timeschedule
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Status
Not open for further replies.

Forum statistics

Threads
1,223,713
Messages
6,174,038
Members
452,542
Latest member
Bricklin

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