![]() |
Input specific value into cell if Row has data
Hi there,
I have a worksheet ("Results") that has several rows of data - in specific columns. I now need to add a specific value into the blank columns of these rows of data: Befo A B C D E 1 coke 24 xxx 2 coke 18 xxx After A B C D E 1 coke TRUE 24 xxx 2 coke TRUE 18 xxx The specific value will be the same on every row. I am able to add this value to every line regardless of whether there is data in that row, however, I ideally only want it when there is data in row. Can someone help me please? If I have been unclear, I will be more than willing to provide more information should it be required. Regards |
Input specific value into cell if Row has data
Hi,
If I didn't misunderstand this formula should work =IF(COUNTA(C8:E8)0,"TRUE","") if any of the cells in the row have data will enter True otherwise will be blank "PVANS" wrote: Hi there, I have a worksheet ("Results") that has several rows of data - in specific columns. I now need to add a specific value into the blank columns of these rows of data: Befo A B C D E 1 coke 24 xxx 2 coke 18 xxx After A B C D E 1 coke TRUE 24 xxx 2 coke TRUE 18 xxx The specific value will be the same on every row. I am able to add this value to every line regardless of whether there is data in that row, however, I ideally only want it when there is data in row. Can someone help me please? If I have been unclear, I will be more than willing to provide more information should it be required. Regards |
Input specific value into cell if Row has data
Try this:
Sub PutValue() Dim specific As String Dim columnn As String Dim n As Long, i As Long specific = "TRUE" columnn = "C" n = Cells(Rows.Count, "A").End(xlUp).Row For i = 1 To n If Application.WorksheetFunction.CountA(Rows(i)) < 0 Then Cells(i, columnn).Value = specific End If Next End Sub -- Gary''s Student - gsnu201001 "PVANS" wrote: Hi there, I have a worksheet ("Results") that has several rows of data - in specific columns. I now need to add a specific value into the blank columns of these rows of data: Befo A B C D E 1 coke 24 xxx 2 coke 18 xxx After A B C D E 1 coke TRUE 24 xxx 2 coke TRUE 18 xxx The specific value will be the same on every row. I am able to add this value to every line regardless of whether there is data in that row, however, I ideally only want it when there is data in row. Can someone help me please? If I have been unclear, I will be more than willing to provide more information should it be required. Regards |
Input specific value into cell if Row has data
I'm not completely clear on what you are looking to do. Is Column C the only
column that you want to put the word TRUE in or did you want to put that word into each blank cell on a row containing some data? Will any column (I'm thinking either A or B) always have data in them when the row contains data? -- Rick (MVP - Excel) "PVANS" wrote in message ... Hi there, I have a worksheet ("Results") that has several rows of data - in specific columns. I now need to add a specific value into the blank columns of these rows of data: Befo A B C D E 1 coke 24 xxx 2 coke 18 xxx After A B C D E 1 coke TRUE 24 xxx 2 coke TRUE 18 xxx The specific value will be the same on every row. I am able to add this value to every line regardless of whether there is data in that row, however, I ideally only want it when there is data in row. Can someone help me please? If I have been unclear, I will be more than willing to provide more information should it be required. Regards |
All times are GMT +1. The time now is 12:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com