Excel, Loop to add data in cells

elias prascjh

New Member
Joined
May 4, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,
I need some help with coding in Excel VBA.

I have a file with 2 worksheets, and I have to code a macro in VBA, but I do not know how this works...

In WS 1 there is data being added by some formulas that extract data from WS 2. I have to operate in WS1.

In column F there is added, what the current status is, I am only interested in " empty". When F has empty in it, then a check has to happen, if column G has "empty" already written into it. If it has, then the loop should ho to the next row.

If G has no "empty" in it, then "empty" should be added to G and the current date should be added into column H.

I would be very pleased if someone could help me with that, because I am pretty new to Excel..

Kind regards.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello, wrote my Idea down in the editor, maybe that helps. sadly I do not know how to bring this into VBA...

IF F="empty" And G="" Then
set G = "empty" And H= Date
ElseIF F="empty" And G="empty"
Endif

Kind Regards
 
Upvote 0
HI, I was now able to set together the If-Statement, how can i implement it into a loop?, and could someone help me with this statement, bacause it does not add the current date into column H, but I also get no error message...

If Range("F2").Value = "empty" And Range("G2").Value = "" Then
Range("G2").Value = "empty"
ElseIf (Range("F2").Value = "empty" And Range("G2").Value = "empty") And Range("H2").Value = "" Then
Range("H2").NumberFormat = "dd.mm.yyyy"
ElseIf (Range("F2").Value = "empty" And Range("G2").Value = "empty") And Range("H2").Value <> "" Then
End If

Kind regards
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

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