Aşağıdaki makroyu buldum, çalışıyor fakat sadece A sütununda çalışıyor, makro kodları arasında sütun ayarını nasıl yapabilirim?
Örneğin;
A, B, C, D ve E sütunlarını doldurmak istiyorum.
Sub doldur()
Dim i, son As Long: son = Cells(Rows.Count, 2).End(xlUp).Row
For i = 1 To son
If Cells(i, 1) = "" Then
Cells(i, 1).Value = Cells(i - 1, 1).Value
End If
Next i
End Sub
Boş Satırları Bir Üstteki Satır ile Doldurma
4
●92
- 09-03-2023, 12:37:24Merhaba,
F5 > Özel > Boşluklar deyip, tüm boşlukları seçin.
Hangi hücrede iseniz, bir üstte ki hücreyi referans alın. Tüm boşlukları seçtiğinizi varsayalım, A1 dolu A2 boş. Boşluklar seçili haldeyken A2'ye =A1 yazıp, CTRL + Enter dediğiniz an tüm boşluklar bir üst hücreye göre dolacaktır. Yapamadığınız taktir de AnyDesk üzerinden anlatabilirim. - 10-03-2023, 10:49:50Aşağıdaki makro kodu ile yapabildim.
İlgilenen arkadaşlara teşekkür ederim.
Sub Fill_Blanks_Cells()
Dim My_Area As Range
On Error Resume Next
Set My_Area = Nothing
Set My_Area = Range("A2:L" & Cells(Rows.Count, 1).End(3).Row).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not My_Area Is Nothing Then
With My_Area
.FormulaR1C1 = "=R[-1]C"
.Value = .Value
End With
MsgBox "Tespit edilen boş hücreler üstteki hücre ile doldurulmuştur.", vbInformation
Else
MsgBox "Boş hücre bulunamadı!", vbExclamation
End If
End Sub - 13-03-2023, 13:53:15Hocam bu yöntemle hücrelerde kayma olmuyor mu, telefondan baktım kodu tam inceleyemedim ama sanırım kayma olacak gibi görünüyor..
Kaymadan kastım şudur.. Örneğin 10 nolu satırda işlem görüyorsunuz.. C10 hücresinin boş olduğunu varsayalım siz bunu üstteki hücre değeri ile dolduruyorsunuz. Eğer verileriniz sırası değil de dağınık ile alakasız veriler alakasız yerlere olmuyorlar mı.. - 13-03-2023, 13:59:12aşağıdaki kod ile sütunları belirlediğim için herhangi bir kayma olmuyor,fatiheryildiz adlı üyeden alıntı: mesajı görüntüle
Sub YukaridakiDegeriYaz() Dim sonSatir As Long Dim i As Long sonSatir = Cells(Rows.Count, "A").End(xlUp).Row For i = 2 To sonSatir If Cells(i, "B").Value = "" Then Cells(i, "B").Value = Cells(i - 1, "B").Value End If If Cells(i, "C").Value = "" Then Cells(i, "C").Value = Cells(i - 1, "C").Value End If If Cells(i, "D").Value = "" Then Cells(i, "D").Value = Cells(i - 1, "D").Value End If If Cells(i, "E").Value = "" Then Cells(i, "E").Value = Cells(i - 1, "E").Value End If If Cells(i, "F").Value = "" Then Cells(i, "F").Value = Cells(i - 1, "F").Value End If If Cells(i, "G").Value = "" Then Cells(i, "G").Value = Cells(i - 1, "G").Value End If If Cells(i, "H").Value = "" Then Cells(i, "H").Value = Cells(i - 1, "H").Value End If If Cells(i, "I").Value = "" Then Cells(i, "I").Value = Cells(i - 1, "I").Value End If If Cells(i, "J").Value = "" Then Cells(i, "J").Value = Cells(i - 1, "J").Value End If If Cells(i, "K").Value = "" Then Cells(i, "K").Value = Cells(i - 1, "K").Value End If If Cells(i, "L").Value = "" Then Cells(i, "L").Value = Cells(i - 1, "L").Value End If Next i End Sub