The aim of this study was to compare the effectiveness of intravitreal ranibizumab (IVR) injections for the treatment of diabetic macular edema (DME) in eyes with and without previous vitrectomy. The medical records of 28 eyes (11 vitrectomized and 17 nonvitrectomized) of 28 patients (mean age, 59.0 ± 9.6 years; male to female ratio 1 : 1) who were diagnosed with DME and had received IVR treatment were reviewed retrospectively. The indications of vitrectomy in 11 vitrectomized eyes were intravitreal hemorrhage (n = 8) and epiretinal membrane (n = 3). The best-corrected visual acuity (BCVA), central macular thickness (CMT), and total macular volume (TMV) were measured at baseline and at months 6, 12, 18, and 24 of the follow-up. The number of IVR injections, the duration between diagnosis of DME and IVR injection, and the hemoglobin A1c (HbA1c) level at baseline were also recorded. Baseline demographics, HbA1c, BCVA, CMT, and TMV values were similar between two groups (p > 0.05). The duration between diagnosis of DME and IVR injections was similar in both groups (16 ± 5 months vs. 13 ± 4 months, respectively; p=0.11). IVR injection was performed 6.3 times in vitrectomized eyes and 6.1 times in nonvitrectomized eyes during the 24-month period (p > 0.05). The mean BCVA improved significantly during the 24-month period in both groups. The improvements in BCVA, in CMT, and in TMV were more significant at month 6 (p=0.036) group, at month 12 (p=0.013), at month 12 (p=0.021), and month 24 (p=0.021) in nonvitrectomized eyes, respectively, while there was no difference in improvements of BCVA, CMT, and TMV in vitrectomized group at each visit. Treatment effected by time in terms of BCVA, CMT, and TMV values in all groups (p=0.0004, p < 0.0001, p < 0.0001, respectively), not by time-group interaction and group (all p values >0.05). In conclusion, IVR treatment for DME is equally effective in both groups. However, the response to treatment is seen earlier in nonvitrectomized eyes compared to vitrectomized eyes.