macro code to remove an element form an array and accept an element from an array

Manish Anchan

New Member
Joined
Jun 28, 2018
Messages
1
hi
i have made a macro code to accept an array from an excel cell.
but right now i am not able to accept a value.
for ex "Series 1, Episode 4 Including the 1980s story of a campaign for a hospice to be built in the Highlands."
from the above example i need to accept series 1 in an array.
and i also want to delete series 1 from the string in the cell from the above example.

my code goes like this

Dim textstring As String, warray() As String
Dim i As Integer
For j = 2 To Range("I6553").End(xlUp).Row
textstring = Range("I" & j + 1).Value
warray = Split(expression:=textstring, delimiter:=" ", limit:=2)
Dim LResult As Integer
LResult = StrComp(warray(0), "Series")
If LResult = "0" Then
warray(0) = Range("I" & j + 1).Value
warray(0) = Range("I" & j + 1)
warray(0) = ""
ElseIf LResult = "-1" Then
LRegionName = "South"
Else
LRegionName = "West"
End If
Next j
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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