Valli's Profile
Expert
9225
Points

Questions
6

112

• Expert Asked on July 9, 2018 in

Hi Jyothi,

Combo Box

Regards

• 40 views
• Expert Asked on July 9, 2018 in

• 24 views
• Expert Asked on October 12, 2017 in

HI ShantanuBendre,

Here is the solution for your query.

```Sub sbCompareData_MultipleRows()
'Variable Declaration

Dim iLstRow As Integer, iCnt As Integer

Dim findValue As String 'It may any datatype
'Find Lastrow

iLstRow = ActiveSheet.Range("A1").CurrentRegion.Rows.Count
'Loop through each cell

For iCnt = iLstRow To 2 Step -1

'Check column 'A' has same data or not

If Range("A" & iCnt) = Range("A" & iCnt - 1) Then

'Check column 'B' has same data or not

If Range("B" & iCnt) = Range("B" & iCnt - 1) Then

'Check column 'C' has same data or not

If Range("C" & iCnt) = Range("C" & iCnt - 1) Then

'If data matches in all 3 columns then Heightlight in yellow color

Range("A" & iCnt & ":C" & iCnt).Interior.Color = 65535

Range("A" & iCnt - 1 & ":C" & iCnt - 1).Interior.Color = 65535

End If

End If

End If

Next
End Sub

```

Hope it resolves your problem.  Please let us know, If you need any further help.

Reagards!

• 111 views
• Expert Asked on October 9, 2017 in

HI AbdulRahman,

Here is the link to consolidate data from multiple worksheets into a single sheet by row using VBA. It explained with examples and clear description.  Please do let us know, If you need any further help.

Consolidate data from multiple Worksheets into a single sheet By Row using VBA

Instructions to Run Macro

Regards!

• 113 views
• Expert Asked on October 7, 2017 in

HI Jesus,

Can you please provide more details. You can share screen shot of excel input and text output. So that it helps us to understand better.

Regards!

• 125 views
• Expert Asked on October 7, 2017 in

HI Shantanubendre,

Here is the solution as per my understand. The below code will check in all three columns in the same row for same data. If same data is available in all 3 columns in same row then it will highlight in yellow color. It compares all types of data whether it can be number or string data.

```Sub sbCompareData()
'Variable Declaration

Dim iLstRow As Integer, iCnt As Integer

Dim findValue As String 'It may any datatype
'Find Lastrow

iLstRow = ActiveSheet.Range("A1").CurrentRegion.Rows.Count
'Loop through each cell

For iCnt = 2 To iLstRow

'Check all 3 column has same data or not

If Range("A" & iCnt) = Range("A" & iCnt) And Range("B" & iCnt) = Range("C" & iCnt) Then

'If data matches in all 3 columns then Heightlight in yellow color

Range("A" & iCnt & ":C" & iCnt).Interior.Color = 65535

End If

Next
End Sub

```

Please do let us know, If any further modifications required.

Regards!

• 111 views
• Expert Asked on September 14, 2017 in

Hi Lora,

Here is the vba code to rename all folders in root folder form existing name to new name.  The below code will loop through all folder names and will update new name.

```Sub ReName_Folders()
Const sRootFolder As String = "C:\Users\IBM_ADMIN\Desktop\3QWk10\SubBrand Integration\"
Dim Old_FolderName As String, New_FolderName As String

With Sheets("Settings")

For i = 2 To .Range("AE1").End(xlDown).Row

Old_FolderName = sRootFolder & Sheets("Settings").Range("AE" & i)

New_FolderName = sRootFolder & Sheets("Settings").Range("AF" & i)

Name Old_FolderName As New_FolderName

Next i

End With
End Sub
```

Regards-Valli

• 121 views
• Expert Asked on September 6, 2017 in

HI Lora,

Here is the solution for your requirement to give name to each slide in PowerPoint Presentation using VBA

```Sub assignNames()
Dim i As Integer
i = 1
For Each sld In ActivePresentation.Slides
ActivePresentation.Slides(i).Name = "Slide" & i
i = i + 1
Next
End Sub

```

Please do let me know, If you need any further help.

Regards!

This answer accepted by Lora. on September 6, 2017 Earned 100 points.

• 132 views
• Expert Asked on September 6, 2017 in

HI Pranab,

Here is the VBA macro for your requirement. I have written comments for each statement for your understand.  You can modify Input sheet name according to you.

```Sub MoveData_To_Multiple_Rows()
'Variable declaration

Dim iCntr As Integer, lstRow As Integer
'Change below Input sheet name

With Sheets("Sheet2")
'Find last row

lstRow = .Cells(.Rows.Count, "A").End(xlUp).Row
'Loop through all rows

For iCntr = lstRow To 2 Step -1

'Check if data is available or not in Column 'F'

If .Range("F" & iCntr) <> "" Then

.Rows(iCntr + 1).Insert Shift:=xlDown

'Copy Date & Day

.Range("A" & iCntr & ":" & "B" & iCntr).Copy Destination:=.Range("A" & iCntr + 1)

'Copy Country & State

.Range("F" & iCntr & ":" & "G" & iCntr).Copy Destination:=.Range("C" & iCntr + 1)

'Update Activity as Workday

.Range("E" & iCntr + 1) = "Work Day"

'Split Count

.Range("J" & iCntr & ":" & "J" & iCntr + 1) = 0.5

'Delete data

.Range("F" & iCntr & ":" & "I" & iCntr) = ""

End If

Next

End With
End Sub
```

Regards!

• 167 views
• Expert Asked on September 5, 2017 in

HI Pranab,

Here is the solution for your query.

```Sub ExportTextFiles()
Dim i As Long
Dim LastDataRow As Long
Dim MyFile As String
Dim fnum
With ActiveSheet
LastDataRow = .Range("A" & Rows.Count).End(xlUp).Row
lastColumn = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With

For i = 2 To LastDataRow
'The next line uses the contents of column B on the same row to name it
MyFile = "C:\Users\pkc504787\Desktop\test\" & ActiveSheet.Range("A" & i).Value & ".dat"    '

fnum = FreeFile()

Open MyFile For Output As fnum

'It reads all values from respective row
For icntr = 1 To lastColumn
Print #1, Cells(i, icntr)
Next icntr

Close fnum
Next i
End Sub
```

Hope it resolves your problem. Please do let us know, If you need any further assistance.

Regards!

• 131 views
• Expert Asked on August 20, 2017 in

Great!

• 190 views