I am trying to use VBA through excel and it loops through the A column and then places a string into the B cells. This works and it pulls the data just fine now. I would like to put something in here that is an if statement to where if the is any value at all then it will skip it. With that being said could something like "*" work for any character?
Function LoopThroughRowsofData()
Dim wb As Workbook Set wb = ThisWorkbook Dim ws As Worksheet Set ws = wb.Sheets("Sheet1") 'wb.sheets("SheetName")
Dim x As Long Dim lastrow As Long Dim firstrow As Long 'first row of data firstrow = 2 lastrow = ws.Cells(Application.Rows.Count, 1).End(xlUp).Row
Dim material As String Dim storagecond As String
For x = firstrow To lastrow material = ws.Cells(x, 1)
storagecond = BlahBlahBlah.Text 'may need .value instead of .text ws.Cells(x, 2) = storagecond
If storagecond = "" Then ws.Cells(x, 2) = "N/A" End If
Next x
Range("E2") = Now() 'Time Stamp End Function
Aucun commentaire:
Enregistrer un commentaire